1
0
Fork 0

feat(missions): make campaign optional and track side-op creators

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Jason Fraley 2026-09-06 23:29:48 -04:00
parent 6fce7c4f86
commit 4f4e2b136f
8 changed files with 46503 additions and 4 deletions

View file

@ -206,6 +206,15 @@ export const Missions: CollectionConfig = {
hidden: true, hidden: true,
}, },
}, },
{
name: "createdBy",
type: "relationship",
relationTo: "users",
admin: {
description:
"Player who scheduled this mission via the Friday Ops calendar (ownership + scheduling-cap tracking). Set automatically; leave empty for staff-created missions.",
},
},
{ {
name: "coverImage", name: "coverImage",
type: "upload", type: "upload",
@ -244,7 +253,7 @@ export const Missions: CollectionConfig = {
name: "campaign", name: "campaign",
type: "relationship", type: "relationship",
relationTo: "campaigns", relationTo: "campaigns",
required: true, required: false,
}, },
{ {
name: "customScripts", name: "customScripts",

View file

@ -37,7 +37,7 @@ export interface MissionCardProps {
readonly startDateTime: string; readonly startDateTime: string;
readonly estimatedDuration: number; readonly estimatedDuration: number;
readonly map: number | Map; readonly map: number | Map;
readonly campaign: number | Campaign; readonly campaign?: number | Campaign | null;
}; };
readonly ownershipAndStatus: { readonly ownershipAndStatus: {
readonly status: readonly status:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "missions" ADD COLUMN "created_by_id" integer;
ALTER TABLE "missions" ADD CONSTRAINT "missions_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
CREATE INDEX "missions_created_by_idx" ON "missions" USING btree ("created_by_id");`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "missions" DROP CONSTRAINT "missions_created_by_id_users_id_fk";
DROP INDEX "missions_created_by_idx";
ALTER TABLE "missions" DROP COLUMN "created_by_id";`)
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "missions" ALTER COLUMN "classification_campaign_id" DROP NOT NULL;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "missions" ALTER COLUMN "classification_campaign_id" SET NOT NULL;`)
}

View file

@ -35,6 +35,8 @@ import * as migration_20260906_065405_add_wiki_template_html from './20260906_06
import * as migration_20260906_100908_add_market_economy_state from './20260906_100908_add_market_economy_state'; import * as migration_20260906_100908_add_market_economy_state from './20260906_100908_add_market_economy_state';
import * as migration_20260906_165837_add_market_state_event_target from './20260906_165837_add_market_state_event_target'; import * as migration_20260906_165837_add_market_state_event_target from './20260906_165837_add_market_state_event_target';
import * as migration_20260906_202925_add_voice_submissions from './20260906_202925_add_voice_submissions'; import * as migration_20260906_202925_add_voice_submissions from './20260906_202925_add_voice_submissions';
import * as migration_20260907_012326_add_missions_created_by from './20260907_012326_add_missions_created_by';
import * as migration_20260907_013724_make_missions_campaign_optional from './20260907_013724_make_missions_campaign_optional';
export const migrations = [ export const migrations = [
{ {
@ -220,6 +222,16 @@ export const migrations = [
{ {
up: migration_20260906_202925_add_voice_submissions.up, up: migration_20260906_202925_add_voice_submissions.up,
down: migration_20260906_202925_add_voice_submissions.down, down: migration_20260906_202925_add_voice_submissions.down,
name: '20260906_202925_add_voice_submissions' name: '20260906_202925_add_voice_submissions',
},
{
up: migration_20260907_012326_add_missions_created_by.up,
down: migration_20260907_012326_add_missions_created_by.down,
name: '20260907_012326_add_missions_created_by',
},
{
up: migration_20260907_013724_make_missions_campaign_optional.up,
down: migration_20260907_013724_make_missions_campaign_optional.down,
name: '20260907_013724_make_missions_campaign_optional'
}, },
]; ];

View file

@ -2376,6 +2376,10 @@ export interface Mission {
* When evaluation reminder DMs were sent for this mission (managed by the bot, one-shot). * When evaluation reminder DMs were sent for this mission (managed by the bot, one-shot).
*/ */
evaluationRemindersSentAt?: string | null; evaluationRemindersSentAt?: string | null;
/**
* Player who scheduled this mission via the Friday Ops calendar (ownership + scheduling-cap tracking). Set automatically; leave empty for staff-created missions.
*/
createdBy?: (number | null) | User;
/** /**
* Background image for the mission page hero header. Renders translucent with a top-to-bottom fade to black. Recommended aspect ratio: 16:9 or wider. * Background image for the mission page hero header. Renders translucent with a top-to-bottom fade to black. Recommended aspect ratio: 16:9 or wider.
*/ */
@ -2383,7 +2387,7 @@ export interface Mission {
classification: { classification: {
map: number | Map; map: number | Map;
missionType: 'Zeus' | 'PvE' | 'PvP' | 'PvPvE' | 'Training' | 'Special'; missionType: 'Zeus' | 'PvE' | 'PvP' | 'PvPvE' | 'Training' | 'Special';
campaign: number | Campaign; campaign?: (number | null) | Campaign;
/** /**
* This mission contains custom SQF scripts. * This mission contains custom SQF scripts.
*/ */
@ -4468,6 +4472,7 @@ export interface MissionsSelect<T extends boolean = true> {
discordAttendanceHash?: T; discordAttendanceHash?: T;
discordAttendanceSentAt?: T; discordAttendanceSentAt?: T;
evaluationRemindersSentAt?: T; evaluationRemindersSentAt?: T;
createdBy?: T;
coverImage?: T; coverImage?: T;
classification?: classification?:
| T | T