feat(profiles): add Call for Fire progression stats with migration
Schema collection field, generated types, and the migration must ship as one unit or the schema drifts 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
4adc0ca452
commit
cce22c1fcc
5 changed files with 23807 additions and 1 deletions
|
|
@ -131,6 +131,7 @@ export const Profiles: CollectionConfig = {
|
||||||
eodMinesweeper?: { xpEarned?: number | null };
|
eodMinesweeper?: { xpEarned?: number | null };
|
||||||
radioTraffic?: { xpEarned?: number | null };
|
radioTraffic?: { xpEarned?: number | null };
|
||||||
aimTrainer?: { xpEarned?: number | null };
|
aimTrainer?: { xpEarned?: number | null };
|
||||||
|
callForFire?: { xpEarned?: number | null };
|
||||||
};
|
};
|
||||||
voiceover?: { xpEarned?: number | null };
|
voiceover?: { xpEarned?: number | null };
|
||||||
};
|
};
|
||||||
|
|
@ -146,6 +147,7 @@ export const Profiles: CollectionConfig = {
|
||||||
const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0;
|
const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0;
|
||||||
const radioTrafficXp = progressionData?.minigames?.radioTraffic?.xpEarned ?? 0;
|
const radioTrafficXp = progressionData?.minigames?.radioTraffic?.xpEarned ?? 0;
|
||||||
const aimTrainerXp = progressionData?.minigames?.aimTrainer?.xpEarned ?? 0;
|
const aimTrainerXp = progressionData?.minigames?.aimTrainer?.xpEarned ?? 0;
|
||||||
|
const callForFireXp = progressionData?.minigames?.callForFire?.xpEarned ?? 0;
|
||||||
const voiceoverXp = progressionData?.voiceover?.xpEarned ?? 0;
|
const voiceoverXp = progressionData?.voiceover?.xpEarned ?? 0;
|
||||||
|
|
||||||
if (awardIds.length > 0) {
|
if (awardIds.length > 0) {
|
||||||
|
|
@ -188,6 +190,8 @@ export const Profiles: CollectionConfig = {
|
||||||
xpAcc += eodXp;
|
xpAcc += eodXp;
|
||||||
xpAcc += radioTrafficXp;
|
xpAcc += radioTrafficXp;
|
||||||
xpAcc += aimTrainerXp;
|
xpAcc += aimTrainerXp;
|
||||||
|
// Call for Fire: XP from effective artillery adjustments
|
||||||
|
xpAcc += callForFireXp;
|
||||||
// Voiceover submissions: XP awarded per accepted submission
|
// Voiceover submissions: XP awarded per accepted submission
|
||||||
xpAcc += voiceoverXp;
|
xpAcc += voiceoverXp;
|
||||||
|
|
||||||
|
|
@ -565,6 +569,60 @@ export const Profiles: CollectionConfig = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "callForFire",
|
||||||
|
label: "Call for Fire",
|
||||||
|
type: "group",
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: "gamesPlayed",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "wins",
|
||||||
|
label: "Wins",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "losses",
|
||||||
|
label: "Losses",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bestScore",
|
||||||
|
label: "Best Score",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "xpEarned",
|
||||||
|
label: "XP Earned",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bestPatrolMissions",
|
||||||
|
label: "Fewest Missions on Best Patrol Support Run",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bestCheckpointMissions",
|
||||||
|
label: "Fewest Missions on Best Checkpoint Defence Run",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bestCompoundMissions",
|
||||||
|
label: "Fewest Missions on Best Compound Strike Run",
|
||||||
|
type: "number",
|
||||||
|
defaultValue: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
23695
src/migrations/20260908_054314_add_call_for_fire_stats.json
Normal file
23695
src/migrations/20260908_054314_add_call_for_fire_stats.json
Normal file
File diff suppressed because it is too large
Load diff
25
src/migrations/20260908_054314_add_call_for_fire_stats.ts
Normal file
25
src/migrations/20260908_054314_add_call_for_fire_stats.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_games_played" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_wins" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_losses" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_best_score" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_xp_earned" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_best_patrol_missions" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_best_checkpoint_missions" numeric DEFAULT 0;
|
||||||
|
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_call_for_fire_best_compound_missions" numeric DEFAULT 0;`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_games_played";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_wins";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_losses";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_best_score";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_xp_earned";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_best_patrol_missions";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_best_checkpoint_missions";
|
||||||
|
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_call_for_fire_best_compound_missions";`)
|
||||||
|
}
|
||||||
|
|
@ -44,6 +44,7 @@ import * as migration_20260907_083010_add_voice_submission_description from './2
|
||||||
import * as migration_20260907_090245_add_mission_ready_reminder_fields from './20260907_090245_add_mission_ready_reminder_fields';
|
import * as migration_20260907_090245_add_mission_ready_reminder_fields from './20260907_090245_add_mission_ready_reminder_fields';
|
||||||
import * as migration_20260907_120754_add_story_beats from './20260907_120754_add_story_beats';
|
import * as migration_20260907_120754_add_story_beats from './20260907_120754_add_story_beats';
|
||||||
import * as migration_20260907_124024_convert_story_beats_body_to_lexical from './20260907_124024_convert_story_beats_body_to_lexical';
|
import * as migration_20260907_124024_convert_story_beats_body_to_lexical from './20260907_124024_convert_story_beats_body_to_lexical';
|
||||||
|
import * as migration_20260908_054314_add_call_for_fire_stats from './20260908_054314_add_call_for_fire_stats';
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -274,6 +275,11 @@ export const migrations = [
|
||||||
{
|
{
|
||||||
up: migration_20260907_124024_convert_story_beats_body_to_lexical.up,
|
up: migration_20260907_124024_convert_story_beats_body_to_lexical.up,
|
||||||
down: migration_20260907_124024_convert_story_beats_body_to_lexical.down,
|
down: migration_20260907_124024_convert_story_beats_body_to_lexical.down,
|
||||||
name: '20260907_124024_convert_story_beats_body_to_lexical'
|
name: '20260907_124024_convert_story_beats_body_to_lexical',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
up: migration_20260908_054314_add_call_for_fire_stats.up,
|
||||||
|
down: migration_20260908_054314_add_call_for_fire_stats.down,
|
||||||
|
name: '20260908_054314_add_call_for_fire_stats'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2037,6 +2037,16 @@ export interface Profile {
|
||||||
eliteBestAccuracy?: number | null;
|
eliteBestAccuracy?: number | null;
|
||||||
xpEarned?: number | null;
|
xpEarned?: number | null;
|
||||||
};
|
};
|
||||||
|
callForFire?: {
|
||||||
|
gamesPlayed?: number | null;
|
||||||
|
wins?: number | null;
|
||||||
|
losses?: number | null;
|
||||||
|
bestScore?: number | null;
|
||||||
|
xpEarned?: number | null;
|
||||||
|
bestPatrolMissions?: number | null;
|
||||||
|
bestCheckpointMissions?: number | null;
|
||||||
|
bestCompoundMissions?: number | null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
voiceover?: {
|
voiceover?: {
|
||||||
xpEarned?: number | null;
|
xpEarned?: number | null;
|
||||||
|
|
@ -4429,6 +4439,18 @@ export interface ProfilesSelect<T extends boolean = true> {
|
||||||
eliteBestAccuracy?: T;
|
eliteBestAccuracy?: T;
|
||||||
xpEarned?: T;
|
xpEarned?: T;
|
||||||
};
|
};
|
||||||
|
callForFire?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
gamesPlayed?: T;
|
||||||
|
wins?: T;
|
||||||
|
losses?: T;
|
||||||
|
bestScore?: T;
|
||||||
|
xpEarned?: T;
|
||||||
|
bestPatrolMissions?: T;
|
||||||
|
bestCheckpointMissions?: T;
|
||||||
|
bestCompoundMissions?: T;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
voiceover?:
|
voiceover?:
|
||||||
| T
|
| T
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue