fix(types): add draft:false and dossier to profiles create calls
This commit is contained in:
parent
97bdf2f40c
commit
9b42d2054c
3 changed files with 21 additions and 3 deletions
|
|
@ -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.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue