fix notifications
Build & Push / Pipeline Tests (push) Failing after 1m8s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 53s
Test / API Unit Tests (push) Failing after 52s
Test / Homepage Unit Tests (push) Successful in 46s
Test / Carplace Unit Tests (push) Successful in 43s
Test / Admin Unit Tests (push) Successful in 43s
Test / Dashboard Unit Tests (push) Successful in 46s
Test / API Integration Tests (push) Successful in 1m7s

This commit is contained in:
root
2026-07-22 22:31:39 -04:00
parent bcabd17220
commit f6fcd7ce54
26 changed files with 1171 additions and 361 deletions
@@ -0,0 +1,94 @@
WITH notification_menu AS (
INSERT INTO "menu_items" (
"id",
"systemKey",
"label",
"itemType",
"routeOrUrl",
"icon",
"displayOrder",
"openInNewTab",
"isRequired",
"isActive",
"createdAt",
"updatedAt",
"createdBy",
"updatedBy"
)
VALUES (
'menu_notifications',
'notifications',
'Notifications',
'INTERNAL_PAGE'::"MenuItemType",
'/notifications',
'Bell',
120,
false,
false,
true,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
'system',
'system'
)
ON CONFLICT ("systemKey") DO UPDATE
SET
"label" = EXCLUDED."label",
"itemType" = EXCLUDED."itemType",
"routeOrUrl" = EXCLUDED."routeOrUrl",
"icon" = EXCLUDED."icon",
"isActive" = true,
"updatedBy" = 'system',
"updatedAt" = CURRENT_TIMESTAMP
RETURNING "id"
),
notification_plan_assignments ("plan", "displayOrder") AS (
VALUES
('STARTER'::"Plan", 120),
('GROWTH'::"Plan", 120),
('PRO'::"Plan", 120)
)
INSERT INTO "subscription_menu_items" (
"id",
"plan",
"menuItemId",
"displayOrder",
"isActive",
"createdAt",
"updatedAt"
)
SELECT
'menu_sub_' || lower(npa."plan"::text) || '_notifications',
npa."plan",
notification_menu."id",
npa."displayOrder",
true,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
FROM notification_plan_assignments npa
CROSS JOIN notification_menu
ON CONFLICT ("plan", "menuItemId") DO UPDATE
SET
"displayOrder" = EXCLUDED."displayOrder",
"isActive" = true,
"updatedAt" = CURRENT_TIMESTAMP;
WITH notification_menu AS (
SELECT "id" FROM "menu_items" WHERE "systemKey" = 'notifications'
),
notification_roles ("role") AS (
VALUES
('OWNER'::"EmployeeRole"),
('MANAGER'::"EmployeeRole"),
('AGENT'::"EmployeeRole")
)
INSERT INTO "menu_item_role_visibility" ("id", "menuItemId", "role", "createdAt", "updatedAt")
SELECT
'menu_role_' || lower(notification_roles."role"::text) || '_notifications',
notification_menu."id",
notification_roles."role",
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
FROM notification_roles
CROSS JOIN notification_menu
ON CONFLICT ("menuItemId", "role") DO NOTHING;