feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain
This commit is contained in:
30
lstV2/server/services/logger/controller/clearLog.ts
Normal file
30
lstV2/server/services/logger/controller/clearLog.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { db } from "../../../../database/dbclient.js";
|
||||
import { logs } from "../../../../database/schema/logs.js";
|
||||
import { createLog } from "../logger.js";
|
||||
|
||||
export const clearLog = async (id: string) => {
|
||||
/**
|
||||
* mark the log as cleared
|
||||
*/
|
||||
|
||||
try {
|
||||
const clear = await db
|
||||
.update(logs)
|
||||
.set({ checked: true, created_at: sql`NOW()` })
|
||||
.where(eq(logs.log_id, id));
|
||||
createLog("info", "lst", "logger", "Log just cleared.");
|
||||
return { success: true, message: "Log was just cleared." };
|
||||
} catch (error) {
|
||||
createLog(
|
||||
"error",
|
||||
"lst",
|
||||
"logger",
|
||||
"There was an error clearing the log."
|
||||
);
|
||||
return {
|
||||
success: false,
|
||||
message: "There was an error clearing the log.",
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user