feat(poker): add poker stats to profiles with migration
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
1fb0165c12
commit
b477103522
3 changed files with 26342 additions and 0 deletions
|
|
@ -132,6 +132,7 @@ export const Profiles: CollectionConfig = {
|
|||
radioTraffic?: { xpEarned?: number | null };
|
||||
aimTrainer?: { xpEarned?: number | null };
|
||||
opordRecall?: { xpEarned?: number | null };
|
||||
poker?: { xpEarned?: number | null };
|
||||
};
|
||||
voiceover?: { xpEarned?: number | null };
|
||||
};
|
||||
|
|
@ -148,6 +149,7 @@ export const Profiles: CollectionConfig = {
|
|||
const radioTrafficXp = progressionData?.minigames?.radioTraffic?.xpEarned ?? 0;
|
||||
const aimTrainerXp = progressionData?.minigames?.aimTrainer?.xpEarned ?? 0;
|
||||
const opordRecallXp = progressionData?.minigames?.opordRecall?.xpEarned ?? 0;
|
||||
const pokerXp = progressionData?.minigames?.poker?.xpEarned ?? 0;
|
||||
const voiceoverXp = progressionData?.voiceover?.xpEarned ?? 0;
|
||||
|
||||
if (awardIds.length > 0) {
|
||||
|
|
@ -191,6 +193,8 @@ export const Profiles: CollectionConfig = {
|
|||
xpAcc += radioTrafficXp;
|
||||
xpAcc += aimTrainerXp;
|
||||
xpAcc += opordRecallXp;
|
||||
// Poker sit-and-go: XP from placement payouts
|
||||
xpAcc += pokerXp;
|
||||
// Voiceover submissions: XP awarded per accepted submission
|
||||
xpAcc += voiceoverXp;
|
||||
|
||||
|
|
@ -631,6 +635,61 @@ export const Profiles: CollectionConfig = {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "poker",
|
||||
label: "Poker",
|
||||
type: "group",
|
||||
fields: [
|
||||
{
|
||||
name: "gamesPlayed",
|
||||
label: "Games Played",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "wins",
|
||||
label: "Wins",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "secondPlaces",
|
||||
label: "Second Places",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "thirdPlaces",
|
||||
label: "Third Places",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "fourthPlaces",
|
||||
label: "Fourth Places",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "handsWon",
|
||||
label: "Hands Won",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "bestScore",
|
||||
label: "Best Score (chips)",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
name: "xpEarned",
|
||||
label: "XP Earned",
|
||||
type: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
26258
src/migrations/20260911_044754_add_poker_minigame_stats.json
Normal file
26258
src/migrations/20260911_044754_add_poker_minigame_stats.json
Normal file
File diff suppressed because it is too large
Load diff
25
src/migrations/20260911_044754_add_poker_minigame_stats.ts
Normal file
25
src/migrations/20260911_044754_add_poker_minigame_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_poker_games_played" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_wins" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_second_places" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_third_places" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_fourth_places" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_hands_won" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_best_score" numeric DEFAULT 0;
|
||||
ALTER TABLE "profiles" ADD COLUMN "progression_minigames_poker_xp_earned" numeric DEFAULT 0;`)
|
||||
}
|
||||
|
||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_games_played";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_wins";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_second_places";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_third_places";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_fourth_places";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_hands_won";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_best_score";
|
||||
ALTER TABLE "profiles" DROP COLUMN "progression_minigames_poker_xp_earned";`)
|
||||
}
|
||||
Loading…
Reference in a new issue