refactor(reprint): new query added to deactivate the old notifcation so no chance of duplicates

This commit is contained in:
2026-04-10 13:57:52 -05:00
parent b0e5fd7999
commit c9eb59e2ad

View File

@@ -9,9 +9,12 @@ import {
import { returnFunc } from "../utils/returnHelper.utils.js";
import { sendEmail } from "../utils/sendEmail.utils.js";
import { tryCatch } from "../utils/trycatch.utils.js";
import { v1QueryRun } from "../utils/pgConnectToLst.utils.js";
const reprint = async (data: any, emails: string) => {
// TODO: do the actual logic for the notification.
// TODO: remove this disable once all 17 plants are on this new lst
v1QueryRun(`update public.notifications set active = false where name = '${data.name}'`)
const { data: l, error: le } = (await tryCatch(
db.select().from(notifications).where(eq(notifications.id, data.id)),
)) as any;