Skip to content

Documentation


Documentation / @kizami/db / findNotificationByTypeAndDate

Function: findNotificationByTypeAndDate()

findNotificationByTypeAndDate(db, params): Promise<{ body: string; createdAt: number; id: string; readAt: number | null; subjectDate: string | null; tenantId: string; title: string; type: string; userId: string; } | null>

Defined in: packages/db/src/queries/notifications.ts:76

(tenantId, userId, type, subjectDate) に一致する通知が既にあるか調べる。

36協定アラート(overtime-alerts.ts)が「reached 通知が既にある月には projected を作らない」 を判定するために使う — createNotificationIfAbsent の UNIQUE 違反捕捉だけでは 「別の type の通知が既にあるか」は分からないため、事前の存在確認として別関数にした。

Parameters

db

Database

params

FindNotificationByTypeAndDateParams

Returns

Promise<{ body: string; createdAt: number; id: string; readAt: number | null; subjectDate: string | null; tenantId: string; title: string; type: string; userId: string; } | null>