feat: add user notification center

This commit is contained in:
Codex
2026-06-30 03:56:41 +08:00
parent 2fea68fe4d
commit d72ff499ce
24 changed files with 895 additions and 44 deletions

View File

@@ -199,6 +199,24 @@ async function main() {
],
);
await client.query(
`
delete from public.user_notifications
where tenant_id = $1
and (
user_id in ($2::uuid, $3::uuid)
or dedupe_key like any($4::text[])
or source_type in ('reports', 'user_badges', 'user_point_exchange_orders')
)
`,
[
tenantId,
ids.user,
ids.secondStudentUser,
['feedback_%', 'badge:%', 'point_exchange:%'],
],
);
await client.query(
`
delete from public.report_status_events
@@ -339,12 +357,13 @@ async function main() {
tenantId,
ids.user,
ids.secondStudentUser,
[ids.tenantBadge, ids.tenantCheckInBadge, ids.tenantScoreBadge, ids.tenantFeedbackBadge],
[ids.tenantBadge, ids.tenantCheckInBadge, ids.tenantScoreBadge, ids.tenantFeedbackBadge, ids.tenantActivityBadge],
[
`badge:${ids.tenantBadge}:user:${ids.user}`,
`auto:${ids.tenantCheckInBadge}:user:${ids.user}`,
`auto:${ids.tenantScoreBadge}:user:${ids.user}`,
`auto:${ids.tenantFeedbackBadge}:user:${ids.user}`,
`auto:${ids.tenantActivityBadge}:user:${ids.user}`,
],
],
);
@@ -358,7 +377,7 @@ async function main() {
or coalesce(legacy_id, '') like 'integration-badge-%'
)
`,
[tenantId, [ids.tenantBadge, ids.tenantCheckInBadge, ids.tenantScoreBadge, ids.tenantFeedbackBadge]],
[tenantId, [ids.tenantBadge, ids.tenantCheckInBadge, ids.tenantScoreBadge, ids.tenantFeedbackBadge, ids.tenantActivityBadge]],
);
await client.query(