feat(server): add game-server sync collections
Add GameServers, ArmaSyncEvents and ArmaCommands collections plus registration in payload config and regenerated types. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
bfb3e1495a
commit
347cbdf956
5 changed files with 192 additions and 0 deletions
18
src/collections/server/ArmaCommands.ts
Normal file
18
src/collections/server/ArmaCommands.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { CollectionConfig } from "payload";
|
||||||
|
|
||||||
|
export const ArmaCommands: CollectionConfig = {
|
||||||
|
slug: "arma-commands",
|
||||||
|
admin: { group: "Server", useAsTitle: "commandId", defaultColumns: ["commandId", "type", "status", "server"] },
|
||||||
|
access: { read: ({ req }) => !!req.user, create: () => false, update: () => false, delete: () => false },
|
||||||
|
fields: [
|
||||||
|
{ name: "commandId", type: "text", required: true, unique: true, index: true },
|
||||||
|
{ name: "server", type: "relationship", relationTo: "game-servers", required: true, index: true },
|
||||||
|
{ name: "type", type: "text", required: true },
|
||||||
|
{ name: "payload", type: "json", required: true },
|
||||||
|
{ name: "status", type: "select", required: true, defaultValue: "queued", options: ["queued", "delivered", "succeeded", "failed"] },
|
||||||
|
{ name: "result", type: "json" },
|
||||||
|
{ name: "error", type: "text" },
|
||||||
|
{ name: "deliveredAt", type: "date" },
|
||||||
|
{ name: "completedAt", type: "date" },
|
||||||
|
],
|
||||||
|
};
|
||||||
14
src/collections/server/ArmaSyncEvents.ts
Normal file
14
src/collections/server/ArmaSyncEvents.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { CollectionConfig } from "payload";
|
||||||
|
|
||||||
|
export const ArmaSyncEvents: CollectionConfig = {
|
||||||
|
slug: "arma-sync-events",
|
||||||
|
admin: { group: "Server", useAsTitle: "eventId", defaultColumns: ["eventId", "type", "server", "occurredAt"] },
|
||||||
|
access: { read: ({ req }) => !!req.user, create: () => false, update: () => false, delete: () => false },
|
||||||
|
fields: [
|
||||||
|
{ name: "eventId", type: "text", required: true, unique: true, index: true },
|
||||||
|
{ name: "server", type: "relationship", relationTo: "game-servers", required: true, index: true },
|
||||||
|
{ name: "type", type: "text", required: true, index: true },
|
||||||
|
{ name: "occurredAt", type: "date", required: true },
|
||||||
|
{ name: "payload", type: "json", required: true },
|
||||||
|
],
|
||||||
|
};
|
||||||
14
src/collections/server/GameServers.ts
Normal file
14
src/collections/server/GameServers.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { CollectionConfig } from "payload";
|
||||||
|
|
||||||
|
export const GameServers: CollectionConfig = {
|
||||||
|
slug: "game-servers",
|
||||||
|
admin: { group: "Server", useAsTitle: "name", defaultColumns: ["name", "serverId", "status", "lastSeenAt"] },
|
||||||
|
access: { read: ({ req }) => !!req.user, create: () => false, update: () => false, delete: () => false },
|
||||||
|
fields: [
|
||||||
|
{ name: "serverId", type: "text", required: true, unique: true, index: true },
|
||||||
|
{ name: "name", type: "text", required: true },
|
||||||
|
{ name: "status", type: "select", required: true, defaultValue: "offline", options: ["online", "offline"] },
|
||||||
|
{ name: "lastSeenAt", type: "date" },
|
||||||
|
{ name: "metadata", type: "json" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -108,6 +108,9 @@ export interface Config {
|
||||||
'narrative-events': NarrativeEvent;
|
'narrative-events': NarrativeEvent;
|
||||||
'mission-files': MissionFile;
|
'mission-files': MissionFile;
|
||||||
'mod-lists': ModList;
|
'mod-lists': ModList;
|
||||||
|
'game-servers': GameServer;
|
||||||
|
'arma-sync-events': ArmaSyncEvent;
|
||||||
|
'arma-commands': ArmaCommand;
|
||||||
'plugin-ai-instructions': PluginAiInstruction;
|
'plugin-ai-instructions': PluginAiInstruction;
|
||||||
'payload-kv': PayloadKv;
|
'payload-kv': PayloadKv;
|
||||||
'payload-locked-documents': PayloadLockedDocument;
|
'payload-locked-documents': PayloadLockedDocument;
|
||||||
|
|
@ -164,6 +167,9 @@ export interface Config {
|
||||||
'narrative-events': NarrativeEventsSelect<false> | NarrativeEventsSelect<true>;
|
'narrative-events': NarrativeEventsSelect<false> | NarrativeEventsSelect<true>;
|
||||||
'mission-files': MissionFilesSelect<false> | MissionFilesSelect<true>;
|
'mission-files': MissionFilesSelect<false> | MissionFilesSelect<true>;
|
||||||
'mod-lists': ModListsSelect<false> | ModListsSelect<true>;
|
'mod-lists': ModListsSelect<false> | ModListsSelect<true>;
|
||||||
|
'game-servers': GameServersSelect<false> | GameServersSelect<true>;
|
||||||
|
'arma-sync-events': ArmaSyncEventsSelect<false> | ArmaSyncEventsSelect<true>;
|
||||||
|
'arma-commands': ArmaCommandsSelect<false> | ArmaCommandsSelect<true>;
|
||||||
'plugin-ai-instructions': PluginAiInstructionsSelect<false> | PluginAiInstructionsSelect<true>;
|
'plugin-ai-instructions': PluginAiInstructionsSelect<false> | PluginAiInstructionsSelect<true>;
|
||||||
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
|
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
|
||||||
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
||||||
|
|
@ -2746,6 +2752,84 @@ export interface NarrativeEvent {
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "game-servers".
|
||||||
|
*/
|
||||||
|
export interface GameServer {
|
||||||
|
id: number;
|
||||||
|
serverId: string;
|
||||||
|
name: string;
|
||||||
|
status: 'online' | 'offline';
|
||||||
|
lastSeenAt?: string | null;
|
||||||
|
metadata?:
|
||||||
|
| {
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
| unknown[]
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| null;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "arma-sync-events".
|
||||||
|
*/
|
||||||
|
export interface ArmaSyncEvent {
|
||||||
|
id: number;
|
||||||
|
eventId: string;
|
||||||
|
server: number | GameServer;
|
||||||
|
type: string;
|
||||||
|
occurredAt: string;
|
||||||
|
payload:
|
||||||
|
| {
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
| unknown[]
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| null;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "arma-commands".
|
||||||
|
*/
|
||||||
|
export interface ArmaCommand {
|
||||||
|
id: number;
|
||||||
|
commandId: string;
|
||||||
|
server: number | GameServer;
|
||||||
|
type: string;
|
||||||
|
payload:
|
||||||
|
| {
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
| unknown[]
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| null;
|
||||||
|
status: 'queued' | 'delivered' | 'succeeded' | 'failed';
|
||||||
|
result?:
|
||||||
|
| {
|
||||||
|
[k: string]: unknown;
|
||||||
|
}
|
||||||
|
| unknown[]
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| boolean
|
||||||
|
| null;
|
||||||
|
error?: string | null;
|
||||||
|
deliveredAt?: string | null;
|
||||||
|
completedAt?: string | null;
|
||||||
|
updatedAt: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "plugin-ai-instructions".
|
* via the `definition` "plugin-ai-instructions".
|
||||||
|
|
@ -2975,6 +3059,18 @@ export interface PayloadLockedDocument {
|
||||||
relationTo: 'mod-lists';
|
relationTo: 'mod-lists';
|
||||||
value: number | ModList;
|
value: number | ModList;
|
||||||
} | null)
|
} | null)
|
||||||
|
| ({
|
||||||
|
relationTo: 'game-servers';
|
||||||
|
value: number | GameServer;
|
||||||
|
} | null)
|
||||||
|
| ({
|
||||||
|
relationTo: 'arma-sync-events';
|
||||||
|
value: number | ArmaSyncEvent;
|
||||||
|
} | null)
|
||||||
|
| ({
|
||||||
|
relationTo: 'arma-commands';
|
||||||
|
value: number | ArmaCommand;
|
||||||
|
} | null)
|
||||||
| ({
|
| ({
|
||||||
relationTo: 'plugin-ai-instructions';
|
relationTo: 'plugin-ai-instructions';
|
||||||
value: number | PluginAiInstruction;
|
value: number | PluginAiInstruction;
|
||||||
|
|
@ -3183,6 +3279,7 @@ export interface UsersSelect<T extends boolean = true> {
|
||||||
showCallsign?: T;
|
showCallsign?: T;
|
||||||
leadOrActual?: T;
|
leadOrActual?: T;
|
||||||
showVersionOverlay?: T;
|
showVersionOverlay?: T;
|
||||||
|
xpDisplayMini?: T;
|
||||||
};
|
};
|
||||||
discord?:
|
discord?:
|
||||||
| T
|
| T
|
||||||
|
|
@ -4196,6 +4293,49 @@ export interface ModListsSelect<T extends boolean = true> {
|
||||||
focalX?: T;
|
focalX?: T;
|
||||||
focalY?: T;
|
focalY?: T;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "game-servers_select".
|
||||||
|
*/
|
||||||
|
export interface GameServersSelect<T extends boolean = true> {
|
||||||
|
serverId?: T;
|
||||||
|
name?: T;
|
||||||
|
status?: T;
|
||||||
|
lastSeenAt?: T;
|
||||||
|
metadata?: T;
|
||||||
|
updatedAt?: T;
|
||||||
|
createdAt?: T;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "arma-sync-events_select".
|
||||||
|
*/
|
||||||
|
export interface ArmaSyncEventsSelect<T extends boolean = true> {
|
||||||
|
eventId?: T;
|
||||||
|
server?: T;
|
||||||
|
type?: T;
|
||||||
|
occurredAt?: T;
|
||||||
|
payload?: T;
|
||||||
|
updatedAt?: T;
|
||||||
|
createdAt?: T;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
|
* via the `definition` "arma-commands_select".
|
||||||
|
*/
|
||||||
|
export interface ArmaCommandsSelect<T extends boolean = true> {
|
||||||
|
commandId?: T;
|
||||||
|
server?: T;
|
||||||
|
type?: T;
|
||||||
|
payload?: T;
|
||||||
|
status?: T;
|
||||||
|
result?: T;
|
||||||
|
error?: T;
|
||||||
|
deliveredAt?: T;
|
||||||
|
completedAt?: T;
|
||||||
|
updatedAt?: T;
|
||||||
|
createdAt?: T;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This interface was referenced by `Config`'s JSON-Schema
|
* This interface was referenced by `Config`'s JSON-Schema
|
||||||
* via the `definition` "plugin-ai-instructions_select".
|
* via the `definition` "plugin-ai-instructions_select".
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ import { Campaigns } from "@/collections/intelligence/Campaigns";
|
||||||
import { Qualifications } from "@/collections/users/Qualifications";
|
import { Qualifications } from "@/collections/users/Qualifications";
|
||||||
import { MissionFiles } from "@/collections/server/MissionFiles";
|
import { MissionFiles } from "@/collections/server/MissionFiles";
|
||||||
import { ModLists } from "@/collections/server/ModLists";
|
import { ModLists } from "@/collections/server/ModLists";
|
||||||
|
import { GameServers } from "@/collections/server/GameServers";
|
||||||
|
import { ArmaSyncEvents } from "@/collections/server/ArmaSyncEvents";
|
||||||
|
import { ArmaCommands } from "@/collections/server/ArmaCommands";
|
||||||
import { Factions } from "@/collections/intelligence/Factions";
|
import { Factions } from "@/collections/intelligence/Factions";
|
||||||
import { Assets } from "@/collections/logistics/Assets";
|
import { Assets } from "@/collections/logistics/Assets";
|
||||||
import { NarrativeEvents } from "@/collections/world/NarrativeEvents";
|
import { NarrativeEvents } from "@/collections/world/NarrativeEvents";
|
||||||
|
|
@ -247,6 +250,9 @@ export default buildConfig({
|
||||||
// Server
|
// Server
|
||||||
MissionFiles,
|
MissionFiles,
|
||||||
ModLists,
|
ModLists,
|
||||||
|
GameServers,
|
||||||
|
ArmaSyncEvents,
|
||||||
|
ArmaCommands,
|
||||||
],
|
],
|
||||||
editor: lexicalEditor({
|
editor: lexicalEditor({
|
||||||
features: ({ rootFeatures }) => {
|
features: ({ rootFeatures }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue