1
0
Fork 0

feat: add faction ownership to game-structures and relax factions read access

- Allow authenticated users to read factions (was developer-only)
- Add optional faction relationship field to game-structures
- Regenerate payload-types.ts
This commit is contained in:
Jason Fraley 2026-07-27 19:19:41 -04:00
parent 1eddf741ff
commit 0280d564f9
3 changed files with 78 additions and 65 deletions

View file

@ -81,6 +81,14 @@ export const GameStructures: CollectionConfig = {
description: "The type of structure this is.", description: "The type of structure this is.",
}, },
}, },
{
name: "faction",
type: "relationship",
relationTo: "factions",
admin: {
description: "The faction that owns this structure.",
},
},
{ {
label: "Geolocation", label: "Geolocation",
type: "group", type: "group",

View file

@ -11,7 +11,7 @@ export const Factions: CollectionConfig = {
create: isDeveloper, create: isDeveloper,
update: isDeveloper, update: isDeveloper,
delete: isDeveloper, delete: isDeveloper,
read: isDeveloper, read: ({ req }) => !!req.user,
}, },
fields: [ fields: [
{ {

View file

@ -226,6 +226,10 @@ export interface GameStructure {
* The type of structure this is. * The type of structure this is.
*/ */
type: number | Structure; type: number | Structure;
/**
* The faction that owns this structure.
*/
faction?: (number | null) | Faction;
/** /**
* @minItems 2 * @minItems 2
* @maxItems 2 * @maxItems 2
@ -850,6 +854,70 @@ export interface Vehicle {
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "factions".
*/
export interface Faction {
id: number;
name: string;
type: 'majorFaction' | 'minorFaction' | 'corporation' | 'special';
description?: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
/**
* Whether or not this faction is playable. Some factions may be specifically intended to be unplayable based on narrative requirements.
*/
playableFaction?: boolean | null;
/**
* Whether or not this faction is/was available as a starting faction at the beginning of the campaign.
*/
startingFaction?: boolean | null;
associatedCampaigns?: (number | Campaign)[] | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "campaigns".
*/
export interface Campaign {
id: number;
name: string;
summary: string;
status: 'concept' | 'inProgress' | 'completed';
description?: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
startDate?: string | null;
endDate?: 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` "users". * via the `definition` "users".
@ -1239,35 +1307,6 @@ export interface Map {
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "campaigns".
*/
export interface Campaign {
id: number;
name: string;
summary: string;
status: 'concept' | 'inProgress' | 'completed';
description?: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
startDate?: string | null;
endDate?: 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` "mission-files". * via the `definition` "mission-files".
@ -1311,41 +1350,6 @@ export interface ModList {
focalX?: number | null; focalX?: number | null;
focalY?: number | null; focalY?: number | null;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "factions".
*/
export interface Faction {
id: number;
name: string;
type: 'majorFaction' | 'minorFaction' | 'corporation' | 'special';
description?: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
} | null;
/**
* Whether or not this faction is playable. Some factions may be specifically intended to be unplayable based on narrative requirements.
*/
playableFaction?: boolean | null;
/**
* Whether or not this faction is/was available as a starting faction at the beginning of the campaign.
*/
startingFaction?: boolean | null;
associatedCampaigns?: (number | Campaign)[] | 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` "narrative-events". * via the `definition` "narrative-events".
@ -1547,6 +1551,7 @@ export interface GameHardResourcesSelect<T extends boolean = true> {
export interface GameStructuresSelect<T extends boolean = true> { export interface GameStructuresSelect<T extends boolean = true> {
name?: T; name?: T;
type?: T; type?: T;
faction?: T;
coordinates?: T; coordinates?: T;
storedResources?: storedResources?:
| T | T