feat: add approval status field to multiple collections with filtering for developer roles
This commit is contained in:
parent
1d55b50c86
commit
ff1f44832e
6 changed files with 166 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { CollectionConfig } from "payload";
|
||||
import { isAdmin } from "@/utils/access-control/isRole";
|
||||
import { isAdmin, isDeveloper } from "@/utils/access-control/isRole";
|
||||
|
||||
export const Technologies: CollectionConfig = {
|
||||
slug: "technologies",
|
||||
|
|
@ -19,6 +19,33 @@ export const Technologies: CollectionConfig = {
|
|||
type: "text",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "approvalStatus",
|
||||
type: "select",
|
||||
label: "Approval Status",
|
||||
options: [
|
||||
{ label: "In Progress", value: "in_progress" },
|
||||
{ label: "Ready for Review", value: "ready_for_review" },
|
||||
{ label: "Approved", value: "approved" },
|
||||
{ label: "Rejected", value: "rejected" },
|
||||
{ label: "Revision Requested", value: "revision_requested" },
|
||||
],
|
||||
defaultValue: "in_progress",
|
||||
filterOptions: ({ options, data, req }) => {
|
||||
return !isDeveloper({ req })
|
||||
? options.filter((option) =>
|
||||
typeof option === "string"
|
||||
? options
|
||||
: ["in_progress", "ready_for_review"].includes(option.value),
|
||||
)
|
||||
: options;
|
||||
},
|
||||
required: true,
|
||||
admin: {
|
||||
description:
|
||||
"Mark whether this technology is ready for developer approval and implementation into the live environment.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
type: "select",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,33 @@ export const Assets: CollectionConfig = {
|
|||
type: "text",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "approvalStatus",
|
||||
type: "select",
|
||||
label: "Approval Status",
|
||||
options: [
|
||||
{ label: "In Progress", value: "in_progress" },
|
||||
{ label: "Ready for Review", value: "ready_for_review" },
|
||||
{ label: "Approved", value: "approved" },
|
||||
{ label: "Rejected", value: "rejected" },
|
||||
{ label: "Revision Requested", value: "revision_requested" },
|
||||
],
|
||||
defaultValue: "in_progress",
|
||||
filterOptions: ({ options, data, req }) => {
|
||||
return !isDeveloper({ req })
|
||||
? options.filter((option) =>
|
||||
typeof option === "string"
|
||||
? options
|
||||
: ["in_progress", "ready_for_review"].includes(option.value),
|
||||
)
|
||||
: options;
|
||||
},
|
||||
required: true,
|
||||
admin: {
|
||||
description:
|
||||
"Mark whether this asset is ready for developer approval and implementation into the live environment.",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "tabs",
|
||||
tabs: [
|
||||
|
|
|
|||
|
|
@ -109,6 +109,33 @@ export const Resources: CollectionConfig = {
|
|||
description: 'Internal ID for scripts (e.g., "res_fuel").',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "approvalStatus",
|
||||
type: "select",
|
||||
label: "Approval Status",
|
||||
options: [
|
||||
{ label: "In Progress", value: "in_progress" },
|
||||
{ label: "Ready for Review", value: "ready_for_review" },
|
||||
{ label: "Approved", value: "approved" },
|
||||
{ label: "Rejected", value: "rejected" },
|
||||
{ label: "Revision Requested", value: "revision_requested" },
|
||||
],
|
||||
defaultValue: "in_progress",
|
||||
filterOptions: ({ options, data, req }) => {
|
||||
return !isDeveloper({ req })
|
||||
? options.filter((option) =>
|
||||
typeof option === "string"
|
||||
? options
|
||||
: ["in_progress", "ready_for_review"].includes(option.value),
|
||||
)
|
||||
: options;
|
||||
},
|
||||
required: true,
|
||||
admin: {
|
||||
description:
|
||||
"Mark whether this resource is ready for developer approval and implementation into the live environment.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "type",
|
||||
type: "select",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { CollectionConfig } from "payload";
|
||||
import { isDeveloper } from "@/utils/access-control/isRole";
|
||||
|
||||
export const Structures: CollectionConfig = {
|
||||
slug: "structures",
|
||||
|
|
@ -27,6 +28,33 @@ export const Structures: CollectionConfig = {
|
|||
description: 'Internal ID for scripts (e.g., "fob_alpha_tier1").',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "approvalStatus",
|
||||
type: "select",
|
||||
label: "Approval Status",
|
||||
options: [
|
||||
{ label: "In Progress", value: "in_progress" },
|
||||
{ label: "Ready for Review", value: "ready_for_review" },
|
||||
{ label: "Approved", value: "approved" },
|
||||
{ label: "Rejected", value: "rejected" },
|
||||
{ label: "Revision Requested", value: "revision_requested" },
|
||||
],
|
||||
defaultValue: "in_progress",
|
||||
filterOptions: ({ options, data, req }) => {
|
||||
return !isDeveloper({ req })
|
||||
? options.filter((option) =>
|
||||
typeof option === "string"
|
||||
? options
|
||||
: ["in_progress", "ready_for_review"].includes(option.value),
|
||||
)
|
||||
: options;
|
||||
},
|
||||
required: true,
|
||||
admin: {
|
||||
description:
|
||||
"Mark whether this structure is ready for developer approval and implementation into the live environment.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "description",
|
||||
type: "richText",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { CollectionConfig } from "payload";
|
||||
import { isDeveloper } from "@/utils/access-control/isRole";
|
||||
|
||||
export const Vehicles: CollectionConfig = {
|
||||
slug: "vehicles",
|
||||
|
|
@ -25,7 +26,34 @@ export const Vehicles: CollectionConfig = {
|
|||
},
|
||||
},
|
||||
{
|
||||
name: "Description",
|
||||
name: "approvalStatus",
|
||||
type: "select",
|
||||
label: "Approval Status",
|
||||
options: [
|
||||
{ label: "In Progress", value: "in_progress" },
|
||||
{ label: "Ready for Review", value: "ready_for_review" },
|
||||
{ label: "Approved", value: "approved" },
|
||||
{ label: "Rejected", value: "rejected" },
|
||||
{ label: "Revision Requested", value: "revision_requested" },
|
||||
],
|
||||
defaultValue: "in_progress",
|
||||
filterOptions: ({ options, data, req }) => {
|
||||
return !isDeveloper({ req })
|
||||
? options.filter((option) =>
|
||||
typeof option === "string"
|
||||
? options
|
||||
: ["in_progress", "ready_for_review"].includes(option.value),
|
||||
)
|
||||
: options;
|
||||
},
|
||||
required: true,
|
||||
admin: {
|
||||
description:
|
||||
"Mark whether this vehicle is ready for developer approval and implementation into the live environment.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "description",
|
||||
type: "richText",
|
||||
admin: {
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -255,6 +255,10 @@ export interface Structure {
|
|||
* Internal ID for scripts (e.g., "fob_alpha_tier1").
|
||||
*/
|
||||
codeName: string;
|
||||
/**
|
||||
* Mark whether this structure is ready for developer approval and implementation into the live environment.
|
||||
*/
|
||||
approvalStatus: 'in_progress' | 'ready_for_review' | 'approved' | 'rejected' | 'revision_requested';
|
||||
/**
|
||||
* A detailed description of the structure, including details like tactical advantages, resource production, and/or world lore regarding this structure.
|
||||
*/
|
||||
|
|
@ -456,6 +460,10 @@ export interface Resource {
|
|||
* Internal ID for scripts (e.g., "res_fuel").
|
||||
*/
|
||||
codeName: string;
|
||||
/**
|
||||
* Mark whether this resource is ready for developer approval and implementation into the live environment.
|
||||
*/
|
||||
approvalStatus: 'in_progress' | 'ready_for_review' | 'approved' | 'rejected' | 'revision_requested';
|
||||
type: 'physical' | 'fluid' | 'energy' | 'abstract';
|
||||
/**
|
||||
* A description of the resource, including where it comes from, how it is used, and any lore-related details.
|
||||
|
|
@ -514,6 +522,10 @@ export interface Resource {
|
|||
export interface Technology {
|
||||
id: number;
|
||||
name: string;
|
||||
/**
|
||||
* Mark whether this technology is ready for developer approval and implementation into the live environment.
|
||||
*/
|
||||
approvalStatus: 'in_progress' | 'ready_for_review' | 'approved' | 'rejected' | 'revision_requested';
|
||||
/**
|
||||
* An "Asset" technology will unlock a new item, vehicle, gear piece, structure, etc. An "Upgrade" technology will unlock an improvement to an Asset, like faster build speed, more storage capacity, etc.
|
||||
*/
|
||||
|
|
@ -574,6 +586,10 @@ export interface Technology {
|
|||
export interface Asset {
|
||||
id: number;
|
||||
name: string;
|
||||
/**
|
||||
* Mark whether this asset is ready for developer approval and implementation into the live environment.
|
||||
*/
|
||||
approvalStatus: 'in_progress' | 'ready_for_review' | 'approved' | 'rejected' | 'revision_requested';
|
||||
className: string;
|
||||
assetType:
|
||||
| 'weapon'
|
||||
|
|
@ -719,10 +735,14 @@ export interface Vehicle {
|
|||
* If not provided, this vehicle will ONLY be available as a virtual asset (i.e., cannot be used in Arma.)
|
||||
*/
|
||||
classname?: string | null;
|
||||
/**
|
||||
* Mark whether this vehicle is ready for developer approval and implementation into the live environment.
|
||||
*/
|
||||
approvalStatus: 'in_progress' | 'ready_for_review' | 'approved' | 'rejected' | 'revision_requested';
|
||||
/**
|
||||
* A detailed description of the vehicle, including details like tactical usage, mechanical details, and/or world lore regarding this vehicle.
|
||||
*/
|
||||
Description?: {
|
||||
description?: {
|
||||
root: {
|
||||
type: string;
|
||||
children: {
|
||||
|
|
@ -1809,6 +1829,7 @@ export interface FactionsSelect<T extends boolean = true> {
|
|||
*/
|
||||
export interface TechnologiesSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
approvalStatus?: T;
|
||||
type?: T;
|
||||
summary?: T;
|
||||
description?: T;
|
||||
|
|
@ -1853,6 +1874,7 @@ export interface TechnologiesSelect<T extends boolean = true> {
|
|||
*/
|
||||
export interface AssetsSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
approvalStatus?: T;
|
||||
className?: T;
|
||||
assetType?: T;
|
||||
'Weapon Configuration'?:
|
||||
|
|
@ -1944,6 +1966,7 @@ export interface ResourcesSelect<T extends boolean = true> {
|
|||
showWarning?: T;
|
||||
name?: T;
|
||||
codeName?: T;
|
||||
approvalStatus?: T;
|
||||
type?: T;
|
||||
description?: T;
|
||||
icon?: T;
|
||||
|
|
@ -1964,7 +1987,8 @@ export interface ResourcesSelect<T extends boolean = true> {
|
|||
export interface VehiclesSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
classname?: T;
|
||||
Description?: T;
|
||||
approvalStatus?: T;
|
||||
description?: T;
|
||||
image?: T;
|
||||
category?: T;
|
||||
materials?:
|
||||
|
|
@ -2028,6 +2052,7 @@ export interface VehiclesSelect<T extends boolean = true> {
|
|||
export interface StructuresSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
codeName?: T;
|
||||
approvalStatus?: T;
|
||||
description?: T;
|
||||
image?: T;
|
||||
category?: T;
|
||||
|
|
|
|||
Loading…
Reference in a new issue