diff --git a/src/collections/users/Users.ts b/src/collections/users/Users.ts index e32bc5c..a8b19ff 100644 --- a/src/collections/users/Users.ts +++ b/src/collections/users/Users.ts @@ -1,5 +1,9 @@ import type { CollectionConfig } from "payload"; -import { requirePermission, hasPermission, isSuperuser } from "@/utils/access-control/hasPermission"; +import { + requirePermission, + hasPermission, + isSuperuser, +} from "@/utils/access-control/hasPermission"; import { ensurePersonalAccount } from "@/lib/banking/index"; import { MUTEABLE_NOTIFICATION_TYPES } from "@/lib/notifications/notificationTypes"; @@ -56,9 +60,13 @@ export const Users: CollectionConfig = { try { await payload.create({ collection: "profiles", + draft: false, data: { user: userId, rank: recruit?.id ?? (null as unknown as number), + dossier: { + enlistmentDate: new Date().toISOString(), + }, progression: { qualifications: [], experience: 0, @@ -214,7 +222,8 @@ export const Users: CollectionConfig = { : options; },*/ admin: { - description: "Legacy role enum — being replaced by the dynamic RBAC system (see 'Role Assignments' below).", + description: + "Legacy role enum — being replaced by the dynamic RBAC system (see 'Role Assignments' below).", }, }, { @@ -227,7 +236,8 @@ export const Users: CollectionConfig = { update: requirePermission("users:assign-roles"), }, admin: { - description: "Dynamic RBAC role assignments. These determine the user's permissions via the roles collection.", + description: + "Dynamic RBAC role assignments. These determine the user's permissions via the roles collection.", }, }, { diff --git a/src/tools/seed/backfillProfiles.ts b/src/tools/seed/backfillProfiles.ts index ba9bb00..9a4d4bc 100644 --- a/src/tools/seed/backfillProfiles.ts +++ b/src/tools/seed/backfillProfiles.ts @@ -67,9 +67,13 @@ export const backfillProfiles = async () => { try { await payload.create({ collection: "profiles", + draft: false, data: { user: user.id, rank: recruitRankId, + dossier: { + enlistmentDate: new Date().toISOString(), + }, progression: { qualifications: [], experience: 0, diff --git a/src/tools/seed/seedProfiles.ts b/src/tools/seed/seedProfiles.ts index 4e86bba..2ccedf6 100644 --- a/src/tools/seed/seedProfiles.ts +++ b/src/tools/seed/seedProfiles.ts @@ -18,6 +18,7 @@ export const seedProfiles = async () => { try { await payload.create({ collection: "profiles", + draft: false, data: { user: ( await payload.find({ @@ -41,6 +42,9 @@ export const seedProfiles = async () => { limit: 1, }) ).docs[0].id, + dossier: { + enlistmentDate: new Date().toISOString(), + }, }, });