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 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 { ensurePersonalAccount } from "@/lib/banking/index";
|
||||||
import { MUTEABLE_NOTIFICATION_TYPES } from "@/lib/notifications/notificationTypes";
|
import { MUTEABLE_NOTIFICATION_TYPES } from "@/lib/notifications/notificationTypes";
|
||||||
|
|
||||||
|
|
@ -56,9 +60,13 @@ export const Users: CollectionConfig = {
|
||||||
try {
|
try {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: "profiles",
|
collection: "profiles",
|
||||||
|
draft: false,
|
||||||
data: {
|
data: {
|
||||||
user: userId,
|
user: userId,
|
||||||
rank: recruit?.id ?? (null as unknown as number),
|
rank: recruit?.id ?? (null as unknown as number),
|
||||||
|
dossier: {
|
||||||
|
enlistmentDate: new Date().toISOString(),
|
||||||
|
},
|
||||||
progression: {
|
progression: {
|
||||||
qualifications: [],
|
qualifications: [],
|
||||||
experience: 0,
|
experience: 0,
|
||||||
|
|
@ -214,7 +222,8 @@ export const Users: CollectionConfig = {
|
||||||
: options;
|
: options;
|
||||||
},*/
|
},*/
|
||||||
admin: {
|
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"),
|
update: requirePermission("users:assign-roles"),
|
||||||
},
|
},
|
||||||
admin: {
|
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 {
|
try {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: "profiles",
|
collection: "profiles",
|
||||||
|
draft: false,
|
||||||
data: {
|
data: {
|
||||||
user: user.id,
|
user: user.id,
|
||||||
rank: recruitRankId,
|
rank: recruitRankId,
|
||||||
|
dossier: {
|
||||||
|
enlistmentDate: new Date().toISOString(),
|
||||||
|
},
|
||||||
progression: {
|
progression: {
|
||||||
qualifications: [],
|
qualifications: [],
|
||||||
experience: 0,
|
experience: 0,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export const seedProfiles = async () => {
|
||||||
try {
|
try {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: "profiles",
|
collection: "profiles",
|
||||||
|
draft: false,
|
||||||
data: {
|
data: {
|
||||||
user: (
|
user: (
|
||||||
await payload.find({
|
await payload.find({
|
||||||
|
|
@ -41,6 +42,9 @@ export const seedProfiles = async () => {
|
||||||
limit: 1,
|
limit: 1,
|
||||||
})
|
})
|
||||||
).docs[0].id,
|
).docs[0].id,
|
||||||
|
dossier: {
|
||||||
|
enlistmentDate: new Date().toISOString(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue