* Refactor reminder push notifications items should always exist and if not, we can just immediately fail imo * Use same text for reminders in /notifications
11 lines
321 B
JavaScript
11 lines
321 B
JavaScript
import { notifyReminder } from '@/lib/webPush'
|
|
|
|
export async function remindUser ({ data: { itemId, userId }, models }) {
|
|
try {
|
|
const item = await models.item.findUnique({ where: { id: itemId } })
|
|
await notifyReminder({ userId, item })
|
|
} catch (err) {
|
|
console.error('failed to send reminder:', err)
|
|
}
|
|
}
|