refactor(reprint): new query added to deactivate the old notifcation so no chance of duplicates
This commit is contained in:
@@ -9,9 +9,12 @@ import {
|
|||||||
import { returnFunc } from "../utils/returnHelper.utils.js";
|
import { returnFunc } from "../utils/returnHelper.utils.js";
|
||||||
import { sendEmail } from "../utils/sendEmail.utils.js";
|
import { sendEmail } from "../utils/sendEmail.utils.js";
|
||||||
import { tryCatch } from "../utils/trycatch.utils.js";
|
import { tryCatch } from "../utils/trycatch.utils.js";
|
||||||
|
import { v1QueryRun } from "../utils/pgConnectToLst.utils.js";
|
||||||
|
|
||||||
const reprint = async (data: any, emails: string) => {
|
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(
|
const { data: l, error: le } = (await tryCatch(
|
||||||
db.select().from(notifications).where(eq(notifications.id, data.id)),
|
db.select().from(notifications).where(eq(notifications.id, data.id)),
|
||||||
)) as any;
|
)) as any;
|
||||||
|
|||||||
Reference in New Issue
Block a user