From 6c71e003c9da57153026350abc23b4ea519e46c8 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 31 Aug 2026 23:40:41 -0400 Subject: [PATCH] feat(config): Update payload config, notifications, and migrations Update Payload configuration: - Import AssignmentTransfers collection in src/payload.config.ts Update notification system: - src/lib/notifications/index.ts: Add transfer notification types - Update notification helper to support new notification types Update migrations index: - src/migrations/index.ts: Register new assignment transfer migrations These changes integrate the AssignmentTransfers collection into the existing Payload configuration and notification infrastructure. --- src/components/frontend/blocks/AppSidebar.tsx | 12 ++++++++++ src/lib/notifications/index.ts | 22 +++++++++++++++++-- src/migrations/index.ts | 14 +++++++++++- src/payload.config.ts | 2 ++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/components/frontend/blocks/AppSidebar.tsx b/src/components/frontend/blocks/AppSidebar.tsx index f89cd2e..ff54cf5 100644 --- a/src/components/frontend/blocks/AppSidebar.tsx +++ b/src/components/frontend/blocks/AppSidebar.tsx @@ -3,6 +3,8 @@ import * as React from "react"; import { Award, + ArrowLeftRight, + ArrowLeftRightIcon, Backpack, Bolt, Crosshair, @@ -54,6 +56,16 @@ const data = { url: "/roster", icon: Users, }, + { + title: "Transfers", + url: "/transfers", + icon: ArrowLeftRight, + }, + { + title: "Transfers", + url: "/transfers", + icon: ArrowLeftRightIcon, + }, ], navHelpdesk: [ { diff --git a/src/lib/notifications/index.ts b/src/lib/notifications/index.ts index 0efe2fd..2cd80a5 100644 --- a/src/lib/notifications/index.ts +++ b/src/lib/notifications/index.ts @@ -8,6 +8,8 @@ export interface NotifyInput { title: string; message?: string; link?: string; + /** Skip both mute suppression checks. Used for operationally critical notifications (assignment transfers). */ + bypassMute?: boolean; } /** Create an in-app notification for a user. Fire-and-forget: failures are logged, not thrown. */ @@ -26,8 +28,10 @@ export async function notifyUser(payload: PayloadType, input: NotifyInput): Prom }; } ).preferences?.notifications; - if (prefs?.mutedAll) return; - if (input.type && prefs?.mutedTypes?.includes(input.type)) return; + if (!input.bypassMute) { + if (prefs?.mutedAll) return; + if (input.type && prefs?.mutedTypes?.includes(input.type)) return; + } await payload.create({ collection: "user-notifications", @@ -87,6 +91,20 @@ export function notificationLabel(type?: string | null): string { return "New reply"; case "ticket:status": return "Ticket updated"; + case "assignment-transfer:request": + return "Transfer request"; + case "assignment-transfer:approved": + return "Transfer approved"; + case "assignment-transfer:rejected": + return "Transfer rejected"; + case "assignment-transfer:escalated": + return "Transfer escalated"; + case "assignment-transfer:resolved": + return "Transfer resolved"; + case "assignment-transfer:completed": + return "Transfer completed"; + case "assignment-transfer:cancelled": + return "Transfer cancelled"; default: return type ?? "Notification"; } diff --git a/src/migrations/index.ts b/src/migrations/index.ts index ec8dbf5..437c075 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -10,6 +10,8 @@ import * as migration_20260828_011500_add_background_texture_preference from './ import * as migration_20260828_041615_add_campaign_mode from './20260828_041615_add_campaign_mode'; import * as migration_20260828_044506 from './20260828_044506'; import * as migration_20260831_142503 from './20260831_142503'; +import * as migration_20260831_180233_assignment_transfers from './20260831_180233_assignment_transfers'; +import * as migration_20260901_014006_add_assignment_transfer_event_target from './20260901_014006_add_assignment_transfer_event_target'; export const migrations = [ { @@ -70,6 +72,16 @@ export const migrations = [ { up: migration_20260831_142503.up, down: migration_20260831_142503.down, - name: '20260831_142503' + name: '20260831_142503', + }, + { + up: migration_20260831_180233_assignment_transfers.up, + down: migration_20260831_180233_assignment_transfers.down, + name: '20260831_180233_assignment_transfers', + }, + { + up: migration_20260901_014006_add_assignment_transfer_event_target.up, + down: migration_20260901_014006_add_assignment_transfer_event_target.down, + name: '20260901_014006_add_assignment_transfer_event_target' }, ]; diff --git a/src/payload.config.ts b/src/payload.config.ts index ce39347..35a7afe 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -30,6 +30,7 @@ import { Vehicles } from "@/collections/logistics/Vehicles"; import { Structures } from "@/collections/logistics/Structures"; import { Shipments } from "@/collections/logistics/Shipments"; import { Assignments } from "@/collections/users/Assignments"; +import { AssignmentTransfers } from "@/collections/users/AssignmentTransfers"; import { Technologies } from "@/collections/intelligence/Technologies"; import { GameRules } from "@/collections/game/GameRules"; import { GameStructures } from "@/collections/game/GameStructures"; @@ -202,6 +203,7 @@ export default buildConfig({ Awards, Qualifications, Assignments, + AssignmentTransfers, Experience, UserNotifications, Evaluations,