feat(intial auth): intial auth setup for the scanner
Some checks failed
Build and Push LST Docker Image / docker (push) Has been cancelled
Some checks failed
Build and Push LST Docker Image / docker (push) Has been cancelled
This commit is contained in:
35
backend/mobile/scanLogs.route.ts
Normal file
35
backend/mobile/scanLogs.route.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Router } from "express";
|
||||
|
||||
import { db } from "../db/db.controller.js";
|
||||
import { scanLog } from "../db/schema/scanlog.schema.js";
|
||||
import { apiReturn } from "../utils/returnHelper.utils.js";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.post("/", async (req, res) => {
|
||||
const body = req.body;
|
||||
|
||||
const newLog = await db
|
||||
.insert(scanLog)
|
||||
.values({
|
||||
scannerId: body.scannerId,
|
||||
message: body.message,
|
||||
prompt: body.prompt,
|
||||
commandDescription: body.commandDescription,
|
||||
status: body.status,
|
||||
lines: body.lines,
|
||||
})
|
||||
.returning();
|
||||
|
||||
return apiReturn(res, {
|
||||
success: true,
|
||||
level: "info",
|
||||
module: "mobile",
|
||||
subModule: "scan logs",
|
||||
message: `New log from ${body.scannerId}`,
|
||||
data: newLog,
|
||||
status: 200,
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user