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.
This commit is contained in:
parent
6fb8dee3f6
commit
6c71e003c9
4 changed files with 47 additions and 3 deletions
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue