style(collections): format Payload collection configs
This commit is contained in:
parent
6685fe68cd
commit
2acf52788f
14 changed files with 82 additions and 55 deletions
|
|
@ -7,7 +7,15 @@ export const BankAccounts: CollectionConfig = {
|
|||
admin: {
|
||||
group: "Banking",
|
||||
useAsTitle: "name",
|
||||
defaultColumns: ["name", "accountType", "ownerUser", "ownerFaction", "balance", "status", "currency"],
|
||||
defaultColumns: [
|
||||
"name",
|
||||
"accountType",
|
||||
"ownerUser",
|
||||
"ownerFaction",
|
||||
"balance",
|
||||
"status",
|
||||
"currency",
|
||||
],
|
||||
},
|
||||
access: {
|
||||
read: ({ req }) => !!req.user,
|
||||
|
|
@ -21,7 +29,7 @@ export const BankAccounts: CollectionConfig = {
|
|||
type: "text",
|
||||
required: true,
|
||||
admin: {
|
||||
description: "Display name for the account (e.g., \"Unit Treasury\", \"Red Faction Reserve\").",
|
||||
description: 'Display name for the account (e.g., "Unit Treasury", "Red Faction Reserve").',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -35,7 +43,8 @@ export const BankAccounts: CollectionConfig = {
|
|||
{ label: "Personal", value: "personal" },
|
||||
],
|
||||
admin: {
|
||||
description: "Treasury = unit-level central funds. Faction = a specific faction's funds. Personal = an individual operator's wallet.",
|
||||
description:
|
||||
"Treasury = unit-level central funds. Faction = a specific faction's funds. Personal = an individual operator's wallet.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -64,7 +73,8 @@ export const BankAccounts: CollectionConfig = {
|
|||
relationTo: "resources",
|
||||
required: true,
|
||||
admin: {
|
||||
description: "The currency this account is denominated in (normally the main currency set in Game Rules).",
|
||||
description:
|
||||
"The currency this account is denominated in (normally the main currency set in Game Rules).",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ export const GameEventLogs: CollectionConfig = {
|
|||
type: "checkbox",
|
||||
defaultValue: true,
|
||||
admin: {
|
||||
description: "System-generated events are created automatically. Uncheck for manual/GM narrative entries.",
|
||||
description:
|
||||
"System-generated events are created automatically. Uncheck for manual/GM narrative entries.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ export const GameHardResources: CollectionConfig = {
|
|||
admin: {
|
||||
group: "Game",
|
||||
useAsTitle: "name",
|
||||
description: "\"Hard Resources\" represent the hard-coded, integral resource types used to power the game. It includes things like Intelligence Points, Command Points, and other non-physical resources that are essential for gameplay mechanics. Unlike regular (\"soft\") resources, hard resources are not calculated by transactions and are instead stored as numeric amounts that are updated by the backend. Soft resources are designed by the players, are defined in the Resources category under Logistics, and are calculated by transactions (ledgers) to ensure their accuracy.",
|
||||
description:
|
||||
'"Hard Resources" represent the hard-coded, integral resource types used to power the game. It includes things like Intelligence Points, Command Points, and other non-physical resources that are essential for gameplay mechanics. Unlike regular ("soft") resources, hard resources are not calculated by transactions and are instead stored as numeric amounts that are updated by the backend. Soft resources are designed by the players, are defined in the Resources category under Logistics, and are calculated by transactions (ledgers) to ensure their accuracy.',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,12 @@ export const GameStructures: CollectionConfig = {
|
|||
structure: d.id,
|
||||
targetCollection: "game-structures",
|
||||
targetId: d.id,
|
||||
data: { previousStored: prev.storedResources, newStored: d.storedResources, previousVoid: prev.voidStorage, newVoid: d.voidStorage },
|
||||
data: {
|
||||
previousStored: prev.storedResources,
|
||||
newStored: d.storedResources,
|
||||
previousVoid: prev.voidStorage,
|
||||
newVoid: d.voidStorage,
|
||||
},
|
||||
});
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -120,8 +120,7 @@ export const Factions: CollectionConfig = {
|
|||
min: -100,
|
||||
max: 100,
|
||||
admin: {
|
||||
description:
|
||||
"Standing from -100 (hostile) to 100 (allied). 0 is neutral.",
|
||||
description: "Standing from -100 (hostile) to 100 (allied). 0 is neutral.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { CollectionConfig, Payload, User } from "payload";
|
||||
import type { CollectionConfig, Payload } from "payload";
|
||||
import { isDeveloper } from "@/utils/access-control/isRole";
|
||||
import hasRoles from "@/utils/access-control/hasRoles";
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ export const LockerStorages: CollectionConfig = {
|
|||
name: "items",
|
||||
type: "array",
|
||||
admin: {
|
||||
description: "Items stored in the locker grid. Position and rotation are managed from the member locker UI.",
|
||||
description:
|
||||
"Items stored in the locker grid. Position and rotation are managed from the member locker UI.",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
|
|
@ -133,7 +134,7 @@ export const LockerStorages: CollectionConfig = {
|
|||
name: "customName",
|
||||
type: "text",
|
||||
admin: {
|
||||
description: "Optional custom name for this item (e.g. \"Frank's Karma\").",
|
||||
description: 'Optional custom name for this item (e.g. "Frank\'s Karma").',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -524,8 +524,7 @@ export const Assets: CollectionConfig = {
|
|||
type: "group",
|
||||
label: "Storage Dimensions",
|
||||
admin: {
|
||||
description:
|
||||
"How this asset occupies space in member lockers and container grids.",
|
||||
description: "How this asset occupies space in member lockers and container grids.",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ export const Shipments: CollectionConfig = {
|
|||
type: "checkbox",
|
||||
defaultValue: false,
|
||||
admin: {
|
||||
description: "If true, the vehicle will automatically return to its origin after completing this shipment.",
|
||||
description:
|
||||
"If true, the vehicle will automatically return to its origin after completing this shipment.",
|
||||
},
|
||||
},
|
||||
// Metadata
|
||||
|
|
|
|||
|
|
@ -52,12 +52,8 @@ export const Structures: CollectionConfig = {
|
|||
}
|
||||
|
||||
const rotated = entry.rotated ?? false;
|
||||
const ew = rotated
|
||||
? (res as any).gridHeight ?? 1
|
||||
: (res as any).gridWidth ?? 1;
|
||||
const eh = rotated
|
||||
? (res as any).gridWidth ?? 1
|
||||
: (res as any).gridHeight ?? 1;
|
||||
const ew = rotated ? ((res as any).gridHeight ?? 1) : ((res as any).gridWidth ?? 1);
|
||||
const eh = rotated ? ((res as any).gridWidth ?? 1) : ((res as any).gridHeight ?? 1);
|
||||
|
||||
let spot: { x: number; y: number } | null = null;
|
||||
for (let y = 0; y <= newY - eh && !spot; y++) {
|
||||
|
|
@ -68,11 +64,11 @@ export const Structures: CollectionConfig = {
|
|||
if (!pRes || typeof pRes !== "object") continue;
|
||||
const pRotated = placed.rotated ?? false;
|
||||
const pw = pRotated
|
||||
? (pRes as any).gridHeight ?? 1
|
||||
: (pRes as any).gridWidth ?? 1;
|
||||
? ((pRes as any).gridHeight ?? 1)
|
||||
: ((pRes as any).gridWidth ?? 1);
|
||||
const ph = pRotated
|
||||
? (pRes as any).gridWidth ?? 1
|
||||
: (pRes as any).gridHeight ?? 1;
|
||||
? ((pRes as any).gridWidth ?? 1)
|
||||
: ((pRes as any).gridHeight ?? 1);
|
||||
const px = placed.gridX;
|
||||
const py = placed.gridY;
|
||||
for (let dx = 0; dx < ew && !overlaps; dx++) {
|
||||
|
|
@ -116,12 +112,8 @@ export const Structures: CollectionConfig = {
|
|||
}
|
||||
|
||||
const rotated = entry.rotated ?? false;
|
||||
const ew = rotated
|
||||
? (res as any).gridHeight ?? 1
|
||||
: (res as any).gridWidth ?? 1;
|
||||
const eh = rotated
|
||||
? (res as any).gridWidth ?? 1
|
||||
: (res as any).gridHeight ?? 1;
|
||||
const ew = rotated ? ((res as any).gridHeight ?? 1) : ((res as any).gridWidth ?? 1);
|
||||
const eh = rotated ? ((res as any).gridWidth ?? 1) : ((res as any).gridHeight ?? 1);
|
||||
|
||||
const gx = entry.gridX;
|
||||
const gy = entry.gridY;
|
||||
|
|
@ -135,11 +127,11 @@ export const Structures: CollectionConfig = {
|
|||
if (!pRes || typeof pRes !== "object") continue;
|
||||
const pRotated = placed.rotated ?? false;
|
||||
const pw = pRotated
|
||||
? (pRes as any).gridHeight ?? 1
|
||||
: (pRes as any).gridWidth ?? 1;
|
||||
? ((pRes as any).gridHeight ?? 1)
|
||||
: ((pRes as any).gridWidth ?? 1);
|
||||
const ph = pRotated
|
||||
? (pRes as any).gridWidth ?? 1
|
||||
: (pRes as any).gridHeight ?? 1;
|
||||
? ((pRes as any).gridWidth ?? 1)
|
||||
: ((pRes as any).gridHeight ?? 1);
|
||||
|
||||
const px = placed.gridX;
|
||||
const py = placed.gridY;
|
||||
|
|
@ -176,11 +168,11 @@ export const Structures: CollectionConfig = {
|
|||
if (!pRes || typeof pRes !== "object") continue;
|
||||
const pRotated = placed.rotated ?? false;
|
||||
const pw = pRotated
|
||||
? (pRes as any).gridHeight ?? 1
|
||||
: (pRes as any).gridWidth ?? 1;
|
||||
? ((pRes as any).gridHeight ?? 1)
|
||||
: ((pRes as any).gridWidth ?? 1);
|
||||
const ph = pRotated
|
||||
? (pRes as any).gridWidth ?? 1
|
||||
: (pRes as any).gridHeight ?? 1;
|
||||
? ((pRes as any).gridWidth ?? 1)
|
||||
: ((pRes as any).gridHeight ?? 1);
|
||||
|
||||
const px = placed.gridX;
|
||||
const py = placed.gridY;
|
||||
|
|
@ -230,7 +222,15 @@ export const Structures: CollectionConfig = {
|
|||
structure: gsDoc.id,
|
||||
targetCollection: "game-structures",
|
||||
targetId: gsDoc.id,
|
||||
data: { oldX, oldY, newX, newY, structureName: gsDoc.name, voidCount: newVoid.length, repositioned: changed },
|
||||
data: {
|
||||
oldX,
|
||||
oldY,
|
||||
newX,
|
||||
newY,
|
||||
structureName: gsDoc.name,
|
||||
voidCount: newVoid.length,
|
||||
repositioned: changed,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ export const Vehicles: CollectionConfig = {
|
|||
required: true,
|
||||
defaultValue: 1,
|
||||
admin: {
|
||||
description:
|
||||
"Fuel consumed per unit of distance traveled.",
|
||||
description: "Fuel consumed per unit of distance traveled.",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ export const MarketListings: CollectionConfig = {
|
|||
name: "desiredPrice",
|
||||
type: "number",
|
||||
admin: {
|
||||
description:
|
||||
"The seller's target price during negotiations. Defaults to the asking price.",
|
||||
description: "The seller's target price during negotiations. Defaults to the asking price.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -87,7 +86,8 @@ export const MarketListings: CollectionConfig = {
|
|||
type: "relationship",
|
||||
relationTo: "resources",
|
||||
admin: {
|
||||
description: "The currency this listing is priced in. Defaults to the main campaign currency.",
|
||||
description:
|
||||
"The currency this listing is priced in. Defaults to the main campaign currency.",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,16 @@ export const MarketNegotiations: CollectionConfig = {
|
|||
admin: {
|
||||
group: "Market",
|
||||
useAsTitle: "id",
|
||||
defaultColumns: ["id", "listing", "buyer", "amount", "patience", "proposedBy", "status", "updatedAt"],
|
||||
defaultColumns: [
|
||||
"id",
|
||||
"listing",
|
||||
"buyer",
|
||||
"amount",
|
||||
"patience",
|
||||
"proposedBy",
|
||||
"status",
|
||||
"updatedAt",
|
||||
],
|
||||
pagination: { defaultLimit: 50 },
|
||||
},
|
||||
access: {
|
||||
|
|
@ -17,10 +26,7 @@ export const MarketNegotiations: CollectionConfig = {
|
|||
if (!user) return false;
|
||||
if (hasRoles(["admin", "developer"], user)) return true;
|
||||
return {
|
||||
or: [
|
||||
{ buyer: { equals: user.id } },
|
||||
{ "listing.seller": { equals: user.id } },
|
||||
],
|
||||
or: [{ buyer: { equals: user.id } }, { "listing.seller": { equals: user.id } }],
|
||||
} as Where;
|
||||
},
|
||||
create: ({ req }) => !!req.user,
|
||||
|
|
@ -29,10 +35,7 @@ export const MarketNegotiations: CollectionConfig = {
|
|||
if (!user) return false;
|
||||
if (hasRoles(["admin", "developer"], user)) return true;
|
||||
return {
|
||||
or: [
|
||||
{ buyer: { equals: user.id } },
|
||||
{ "listing.seller": { equals: user.id } },
|
||||
],
|
||||
or: [{ buyer: { equals: user.id } }, { "listing.seller": { equals: user.id } }],
|
||||
} as Where;
|
||||
},
|
||||
delete: isDeveloper,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,15 @@ export const Tickets: CollectionConfig = {
|
|||
admin: {
|
||||
group: "Helpdesk",
|
||||
useAsTitle: "title",
|
||||
defaultColumns: ["title", "status", "priority", "category", "reporter", "assignee", "updatedAt"],
|
||||
defaultColumns: [
|
||||
"title",
|
||||
"status",
|
||||
"priority",
|
||||
"category",
|
||||
"reporter",
|
||||
"assignee",
|
||||
"updatedAt",
|
||||
],
|
||||
listSearchableFields: ["title", "id"],
|
||||
pagination: { defaultLimit: 50 },
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue