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 { CollectionConfig } from "payload";
|
||||||
import { isAdmin } from "@/utils/access-control/isRole";
|
import { isAdmin, isDeveloper } from "@/utils/access-control/isRole";
|
||||||
|
|
||||||
export const Technologies: CollectionConfig = {
|
export const Technologies: CollectionConfig = {
|
||||||
slug: "technologies",
|
slug: "technologies",
|
||||||
|
|
@ -19,6 +19,33 @@ export const Technologies: CollectionConfig = {
|
||||||
type: "text",
|
type: "text",
|
||||||
required: true,
|
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",
|
name: "type",
|
||||||
type: "select",
|
type: "select",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,33 @@ export const Assets: CollectionConfig = {
|
||||||
type: "text",
|
type: "text",
|
||||||
required: true,
|
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",
|
type: "tabs",
|
||||||
tabs: [
|
tabs: [
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,33 @@ export const Resources: CollectionConfig = {
|
||||||
description: 'Internal ID for scripts (e.g., "res_fuel").',
|
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",
|
name: "type",
|
||||||
type: "select",
|
type: "select",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CollectionConfig } from "payload";
|
import { CollectionConfig } from "payload";
|
||||||
|
import { isDeveloper } from "@/utils/access-control/isRole";
|
||||||
|
|
||||||
export const Structures: CollectionConfig = {
|
export const Structures: CollectionConfig = {
|
||||||
slug: "structures",
|
slug: "structures",
|
||||||
|
|
@ -27,6 +28,33 @@ export const Structures: CollectionConfig = {
|
||||||
description: 'Internal ID for scripts (e.g., "fob_alpha_tier1").',
|
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",
|
name: "description",
|
||||||
type: "richText",
|
type: "richText",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { CollectionConfig } from "payload";
|
import { CollectionConfig } from "payload";
|
||||||
|
import { isDeveloper } from "@/utils/access-control/isRole";
|
||||||
|
|
||||||
export const Vehicles: CollectionConfig = {
|
export const Vehicles: CollectionConfig = {
|
||||||
slug: "vehicles",
|
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",
|
type: "richText",
|
||||||
admin: {
|
admin: {
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,10 @@ export interface Structure {
|
||||||
* Internal ID for scripts (e.g., "fob_alpha_tier1").
|
* Internal ID for scripts (e.g., "fob_alpha_tier1").
|
||||||
*/
|
*/
|
||||||
codeName: string;
|
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.
|
* 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").
|
* Internal ID for scripts (e.g., "res_fuel").
|
||||||
*/
|
*/
|
||||||
codeName: string;
|
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';
|
type: 'physical' | 'fluid' | 'energy' | 'abstract';
|
||||||
/**
|
/**
|
||||||
* A description of the resource, including where it comes from, how it is used, and any lore-related details.
|
* 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 {
|
export interface Technology {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
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.
|
* 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 {
|
export interface Asset {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
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;
|
className: string;
|
||||||
assetType:
|
assetType:
|
||||||
| 'weapon'
|
| '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.)
|
* If not provided, this vehicle will ONLY be available as a virtual asset (i.e., cannot be used in Arma.)
|
||||||
*/
|
*/
|
||||||
classname?: string | null;
|
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.
|
* A detailed description of the vehicle, including details like tactical usage, mechanical details, and/or world lore regarding this vehicle.
|
||||||
*/
|
*/
|
||||||
Description?: {
|
description?: {
|
||||||
root: {
|
root: {
|
||||||
type: string;
|
type: string;
|
||||||
children: {
|
children: {
|
||||||
|
|
@ -1809,6 +1829,7 @@ export interface FactionsSelect<T extends boolean = true> {
|
||||||
*/
|
*/
|
||||||
export interface TechnologiesSelect<T extends boolean = true> {
|
export interface TechnologiesSelect<T extends boolean = true> {
|
||||||
name?: T;
|
name?: T;
|
||||||
|
approvalStatus?: T;
|
||||||
type?: T;
|
type?: T;
|
||||||
summary?: T;
|
summary?: T;
|
||||||
description?: T;
|
description?: T;
|
||||||
|
|
@ -1853,6 +1874,7 @@ export interface TechnologiesSelect<T extends boolean = true> {
|
||||||
*/
|
*/
|
||||||
export interface AssetsSelect<T extends boolean = true> {
|
export interface AssetsSelect<T extends boolean = true> {
|
||||||
name?: T;
|
name?: T;
|
||||||
|
approvalStatus?: T;
|
||||||
className?: T;
|
className?: T;
|
||||||
assetType?: T;
|
assetType?: T;
|
||||||
'Weapon Configuration'?:
|
'Weapon Configuration'?:
|
||||||
|
|
@ -1944,6 +1966,7 @@ export interface ResourcesSelect<T extends boolean = true> {
|
||||||
showWarning?: T;
|
showWarning?: T;
|
||||||
name?: T;
|
name?: T;
|
||||||
codeName?: T;
|
codeName?: T;
|
||||||
|
approvalStatus?: T;
|
||||||
type?: T;
|
type?: T;
|
||||||
description?: T;
|
description?: T;
|
||||||
icon?: T;
|
icon?: T;
|
||||||
|
|
@ -1964,7 +1987,8 @@ export interface ResourcesSelect<T extends boolean = true> {
|
||||||
export interface VehiclesSelect<T extends boolean = true> {
|
export interface VehiclesSelect<T extends boolean = true> {
|
||||||
name?: T;
|
name?: T;
|
||||||
classname?: T;
|
classname?: T;
|
||||||
Description?: T;
|
approvalStatus?: T;
|
||||||
|
description?: T;
|
||||||
image?: T;
|
image?: T;
|
||||||
category?: T;
|
category?: T;
|
||||||
materials?:
|
materials?:
|
||||||
|
|
@ -2028,6 +2052,7 @@ export interface VehiclesSelect<T extends boolean = true> {
|
||||||
export interface StructuresSelect<T extends boolean = true> {
|
export interface StructuresSelect<T extends boolean = true> {
|
||||||
name?: T;
|
name?: T;
|
||||||
codeName?: T;
|
codeName?: T;
|
||||||
|
approvalStatus?: T;
|
||||||
description?: T;
|
description?: T;
|
||||||
image?: T;
|
image?: T;
|
||||||
category?: T;
|
category?: T;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue