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:
parent
1eddf741ff
commit
0280d564f9
3 changed files with 78 additions and 65 deletions
|
|
@ -81,6 +81,14 @@ export const GameStructures: CollectionConfig = {
|
|||
description: "The type of structure this is.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "faction",
|
||||
type: "relationship",
|
||||
relationTo: "factions",
|
||||
admin: {
|
||||
description: "The faction that owns this structure.",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Geolocation",
|
||||
type: "group",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export const Factions: CollectionConfig = {
|
|||
create: isDeveloper,
|
||||
update: isDeveloper,
|
||||
delete: isDeveloper,
|
||||
read: isDeveloper,
|
||||
read: ({ req }) => !!req.user,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ export interface GameStructure {
|
|||
* The type of structure this is.
|
||||
*/
|
||||
type: number | Structure;
|
||||
/**
|
||||
* The faction that owns this structure.
|
||||
*/
|
||||
faction?: (number | null) | Faction;
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
|
|
@ -850,6 +854,70 @@ export interface Vehicle {
|
|||
updatedAt: 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
|
||||
* via the `definition` "users".
|
||||
|
|
@ -1239,35 +1307,6 @@ export interface Map {
|
|||
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
|
||||
* via the `definition` "mission-files".
|
||||
|
|
@ -1311,41 +1350,6 @@ export interface ModList {
|
|||
focalX?: 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
|
||||
* via the `definition` "narrative-events".
|
||||
|
|
@ -1547,6 +1551,7 @@ export interface GameHardResourcesSelect<T extends boolean = true> {
|
|||
export interface GameStructuresSelect<T extends boolean = true> {
|
||||
name?: T;
|
||||
type?: T;
|
||||
faction?: T;
|
||||
coordinates?: T;
|
||||
storedResources?:
|
||||
| T
|
||||
|
|
|
|||
Loading…
Reference in a new issue