refactor(ocp): change the way logs are brought in and other changes to clean the code up

This commit is contained in:
2025-04-09 17:49:03 -05:00
parent bad390ec17
commit 2e2699ab3c
20 changed files with 307 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
import { and, eq, gte, inArray, lte, sql } from "drizzle-orm";
import { and, desc, eq, gte, inArray, lte, sql } from "drizzle-orm";
import { db } from "../../../../database/dbclient.js";
import { logs } from "../../../../database/schema/logs.js";
import { createLog } from "../logger.js";
@@ -21,7 +21,8 @@ export const getLogs = async (data: any) => {
inArray(logs.level, data.level),
eq(logs.checked, checked)
)
);
)
.orderBy(desc(logs.created_at));
return { success: true, message: "logs returned", data: logData };
} catch (error) {