refactor(db): added in notifications vs pulling from the db makes it easier on the system

This commit is contained in:
2026-06-10 16:26:21 -05:00
parent 9440b44f3b
commit 706ab8b448
6 changed files with 229 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
import { db } from "./db.controller.js";
export const getRecentLogs = ({
module,
submodule,
limit = 200,
}: {
module?: string | undefined;
submodule?: string | undefined;
limit?: number | undefined;
}) => {
return db.query.logs.findMany({
where: (logs, { and, eq }) =>
and(
module ? eq(logs.module, module) : undefined,
submodule ? eq(logs.subModule, submodule) : undefined,
),
orderBy: (logs, { desc }) => [desc(logs.createdAt)],
limit,
});
};