feat(minigames): add phasing-out status with estimated removal date
Add a "phasingOut" minigame status and an `estimatedRemovalDate` field so a game can be announced as leaving soon while staying fully playable and keeping scoring periods (unlike retired games). Visibility is the only difference: - Sidebar badge + tooltip (amber "Phasing out", countdown to removal) in NavMinigames, via new phasingOutTooltip in countdown.ts. - In-game banner (PhasingOutBanner) on all 9 game pages, wired from getMinigameReleaseState (added the fetch to call-for-fire, which lacked it). - registry.ts status union + field; loadRegistry.ts maps the field; config status select + estimatedRemovalDate date field added. - Migration adds the enum value and column (idempotent); types + db schema regenerated. Adds tests for visibility, round-trip, and period scoring; updates the minigames domain guide.
This commit is contained in:
parent
43397f16cb
commit
33f3f7aa75
23 changed files with 443 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Club } from "lucide-react";
|
||||
import { BlackjackArena } from "@/components/frontend/minigames/blackjack/BlackjackArena";
|
||||
|
|
@ -66,6 +67,9 @@ export default async function BlackjackPage({ searchParams }: BlackjackPageProps
|
|||
|
||||
return (
|
||||
<div className="flex flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Club className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { headers as nextHeaders } from "next/headers";
|
|||
import { redirect } from "next/navigation";
|
||||
import { Swords } from "lucide-react";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { CallForFireVersusArena } from "@/components/frontend/minigames/call-for-fire-versus/CallForFireVersusArena";
|
||||
|
||||
|
|
@ -62,6 +63,9 @@ export default async function CallForFireVersusPage({ searchParams }: VersusPage
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Swords className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import { redirect } from "next/navigation";
|
|||
import { Target } from "lucide-react";
|
||||
import { CallForFireArena } from "@/components/frontend/minigames/call-for-fire/CallForFireArena";
|
||||
import { PeriodStandingsCard } from "@/components/frontend/minigames/PeriodStandingsCard";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Call for Fire (Polaris Task Force)",
|
||||
|
|
@ -22,6 +24,8 @@ export default async function CallForFirePage() {
|
|||
redirect(`/login?returnTo=${encodeURIComponent("/minigames/call-for-fire")}`);
|
||||
}
|
||||
|
||||
const release = await getMinigameReleaseState(payload, "callForFire");
|
||||
|
||||
const profileRes = await payload.find({
|
||||
collection: "profiles",
|
||||
where: { user: { equals: user.id as number } },
|
||||
|
|
@ -50,6 +54,9 @@ export default async function CallForFirePage() {
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Target className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Bomb } from "lucide-react";
|
||||
import { EodArena } from "@/components/frontend/minigames/eod/EodArena";
|
||||
|
|
@ -57,6 +58,9 @@ export default async function EodPage() {
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bomb className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Bird } from "lucide-react";
|
||||
import { FlappyArena } from "@/components/frontend/minigames/flappy/FlappyArena";
|
||||
|
|
@ -54,6 +55,9 @@ export default async function FlappyPage() {
|
|||
|
||||
return (
|
||||
<div className="p-5 flex flex-col gap-6">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bird className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { ScrollText } from "lucide-react";
|
||||
import { OpordArena } from "@/components/frontend/minigames/opord/OpordArena";
|
||||
|
|
@ -58,6 +59,9 @@ export default async function OpordPage() {
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<ScrollText className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Spade } from "lucide-react";
|
||||
import { PokerArena } from "@/components/frontend/minigames/poker/PokerArena";
|
||||
|
|
@ -66,6 +67,9 @@ export default async function PokerPage({ searchParams }: PokerPageProps) {
|
|||
|
||||
return (
|
||||
<div className="flex flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Spade className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Crosshair } from "lucide-react";
|
||||
|
||||
|
|
@ -62,6 +63,9 @@ export default async function QualificationPage() {
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Crosshair className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { getPayload } from "payload";
|
|||
import { headers as nextHeaders } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { MinigameComingSoon } from "@/components/frontend/minigames/MinigameComingSoon";
|
||||
import { PhasingOutBanner } from "@/components/frontend/minigames/PhasingOutBanner";
|
||||
import { getMinigameReleaseState } from "@/lib/minigames/loadRegistry";
|
||||
import { Radio } from "lucide-react";
|
||||
import { RadioArena } from "@/components/frontend/minigames/radio/RadioArena";
|
||||
|
|
@ -66,6 +67,9 @@ export default async function RadioPage() {
|
|||
|
||||
return (
|
||||
<div className="flex min-w-0 flex-col gap-6 p-5">
|
||||
{release.game?.status === "phasingOut" && (
|
||||
<PhasingOutBanner estimatedRemovalDate={release.game.estimatedRemovalDate} />
|
||||
)}
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<Radio className="size-5 text-muted-foreground" />
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export const Minigames: CollectionConfig = {
|
|||
{ label: "Active", value: "active" },
|
||||
{ label: "Upcoming", value: "upcoming" },
|
||||
{ label: "Retired", value: "retired" },
|
||||
{ label: "Phasing out", value: "phasingOut" },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
@ -83,6 +84,15 @@ export const Minigames: CollectionConfig = {
|
|||
"Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "estimatedRemovalDate",
|
||||
type: "date",
|
||||
admin: {
|
||||
date: { pickerAppearance: "dayAndTime" },
|
||||
description:
|
||||
"Optional target for a phasing-out game. Shown as a countdown in the sidebar and on the game page so operators know when it leaves. Display only: the game stays playable until status changes to Retired.",
|
||||
},
|
||||
},
|
||||
{ name: "order", type: "number", required: true, defaultValue: 0 },
|
||||
{
|
||||
name: "countsForPeriods",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Link from "next/link";
|
|||
|
||||
import { minigameIcon } from "@/components/frontend/minigames/minigameIcon";
|
||||
import { UpcomingCountdown } from "@/components/frontend/minigames/UpcomingCountdown";
|
||||
import { phasingOutTooltip } from "@/lib/minigames/countdown";
|
||||
import type { RegistryGame } from "@/lib/minigames/registry";
|
||||
import {
|
||||
DropdownMenu,
|
||||
|
|
@ -31,6 +32,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
|
|||
* links: they render as a plain hoverable row rather than a disabled
|
||||
* `DropdownMenuItem`, because that item sets `pointer-events: none` when
|
||||
* disabled, which would suppress the hover that reveals the tooltip.
|
||||
* `phasingOut` games stay clickable but carry an amber "Phasing out" badge and a
|
||||
* tooltip showing the optional `estimatedRemovalDate`.
|
||||
*/
|
||||
export function NavMinigames({ games }: { games: RegistryGame[] }) {
|
||||
const { isMobile } = useSidebar();
|
||||
|
|
@ -65,6 +68,27 @@ export function NavMinigames({ games }: { games: RegistryGame[] }) {
|
|||
);
|
||||
}
|
||||
|
||||
if (game.status === "phasingOut") {
|
||||
return (
|
||||
<Tooltip key={game.key}>
|
||||
<TooltipTrigger asChild>
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href={game.route}>
|
||||
<Icon />
|
||||
<span className="truncate">{game.label}</span>
|
||||
<span className="ml-auto shrink-0 text-[10px] font-normal uppercase tracking-wide text-amber-400">
|
||||
Phasing out
|
||||
</span>
|
||||
</Link>
|
||||
</DropdownMenuItem>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side={isMobile ? "bottom" : "right"}>
|
||||
<span>{phasingOutTooltip(game.estimatedRemovalDate)}</span>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenuItem key={game.key} asChild>
|
||||
<Link href={game.route}>
|
||||
|
|
|
|||
46
src/components/frontend/minigames/PhasingOutBanner.tsx
Normal file
46
src/components/frontend/minigames/PhasingOutBanner.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
"use client";
|
||||
|
||||
import { AlarmClockIcon } from "lucide-react";
|
||||
|
||||
import { useNow } from "@/hooks/useNow";
|
||||
import { formatCountdown, formatReleaseInstant } from "@/lib/minigames/countdown";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface PhasingOutBannerProps {
|
||||
readonly estimatedRemovalDate?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* In-game notice for a minigame whose registry status is "phasingOut". The game
|
||||
* stays fully playable and keeps scoring periods until it is removed; this just
|
||||
* tells operators when it is leaving. Display only.
|
||||
*/
|
||||
export function PhasingOutBanner({ estimatedRemovalDate }: PhasingOutBannerProps) {
|
||||
const now = useNow();
|
||||
const instant = formatReleaseInstant(estimatedRemovalDate ?? null);
|
||||
const countdown = formatCountdown(estimatedRemovalDate ?? null, new Date(now));
|
||||
|
||||
return (
|
||||
<div
|
||||
role="note"
|
||||
aria-label="This minigame is being phased out"
|
||||
className={cn(
|
||||
"flex items-center gap-3 rounded-lg border px-4 py-3 text-sm",
|
||||
"border-amber-500/30 bg-amber-500/10 text-amber-100",
|
||||
)}
|
||||
>
|
||||
<AlarmClockIcon className="size-5 shrink-0 text-amber-400" />
|
||||
<p className="min-w-0">
|
||||
<span className="font-semibold">This game is being phased out.</span>{" "}
|
||||
{instant ? (
|
||||
<>
|
||||
Leaving <span className="font-medium">{instant}</span>
|
||||
{countdown ? ` (in ${countdown})` : "."}
|
||||
</>
|
||||
) : (
|
||||
"No removal date has been set yet."
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -58,3 +58,4 @@ code; the invariants are:
|
|||
leaderboards, and their page renders `MinigameComingSoon` instead of the arena. The date is
|
||||
display only: the game goes live when an admin flips `status` to active. Countdown formatting:
|
||||
`src/lib/minigames/countdown.ts`; page gate: `getMinigameReleaseState` plus a per-page check.
|
||||
- **Phasing-out games**: a registry row with `status: "phasingOut"` stays fully playable and keeps scoring periods until it is removed. It shows an amber "Phasing out" badge in the sidebar (tooltip over the optional `estimatedRemovalDate`, via `phasingOutTooltip`) and a banner (`PhasingOutBanner`) on its game page, both rendering the countdown to removal. Unlike `retired` games, phasing-out games stay visible in the nav (`visibleRegistryGames` does not filter them) and on the leaderboards (`buildLeaderboardPayload` only excludes `upcoming`). The date is display only: the game keeps playing until an admin flips `status` to `retired`.
|
||||
|
|
|
|||
|
|
@ -68,3 +68,20 @@ export function upcomingTooltip(
|
|||
const countdown = formatCountdown(estimatedReleaseDate, now);
|
||||
return countdown ? `Upcoming · releases ${instant} (${countdown})` : `Upcoming · releases ${instant}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full tooltip line for a phasing-out game, e.g.
|
||||
* "Phasing out · leaves Dec 3, 2026 18:00 UTC (in 12d 3h)". Reduces to just
|
||||
* "Phasing out" when no estimate is set.
|
||||
*/
|
||||
export function phasingOutTooltip(
|
||||
estimatedRemovalDate: string | null | undefined,
|
||||
now: Date = new Date(),
|
||||
): string {
|
||||
const instant = formatReleaseInstant(estimatedRemovalDate);
|
||||
if (!instant) return "Phasing out";
|
||||
const countdown = formatCountdown(estimatedRemovalDate, now);
|
||||
return countdown
|
||||
? `Phasing out · leaves ${instant} (${countdown})`
|
||||
: `Phasing out · leaves ${instant}`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export async function loadMinigameRegistry(payload: Payload): Promise<BuiltinMin
|
|||
countsForPeriods: Boolean(doc.countsForPeriods),
|
||||
scoreLabel: doc.scoreLabel || "Score",
|
||||
estimatedReleaseDate: doc.estimatedReleaseDate ?? null,
|
||||
estimatedRemovalDate: doc.estimatedRemovalDate ?? null,
|
||||
}),
|
||||
);
|
||||
if (rows.length > 0) return rows;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
export type MinigameCategory = "core" | "cardtable" | "multiplayer";
|
||||
export type MinigameStatus = "active" | "retired" | "upcoming";
|
||||
export type MinigameStatus = "active" | "retired" | "upcoming" | "phasingOut";
|
||||
|
||||
/** The six period-scoring games. Poker and Blackjack stay out of periods. */
|
||||
export const CORE_MINIGAME_KEYS = [
|
||||
|
|
@ -50,6 +50,12 @@ export interface BuiltinMinigame {
|
|||
* changes `status` to "active", so a slipped estimate never exposes it.
|
||||
*/
|
||||
estimatedReleaseDate?: string | null;
|
||||
/**
|
||||
* Optional target removal instant (ISO 8601, UTC) shown as a countdown while
|
||||
* `status` is "phasingOut". Display only: the game stays fully playable and
|
||||
* keeps scoring periods until an admin sets `status` to "retired".
|
||||
*/
|
||||
estimatedRemovalDate?: string | null;
|
||||
}
|
||||
|
||||
/** The seven built-in games, seeded into the `minigames` registry collection. */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from "@payloadcms/db-postgres";
|
||||
|
||||
/**
|
||||
* Adds `phasingOut` to the minigames status enum and the
|
||||
* `estimated_removal_date` column so a game can be marked as leaving soon while
|
||||
* staying playable. Follows the precedent of 20261011_221250 (column) and
|
||||
* 20261014_135614 (enum value): idempotent via IF NOT EXISTS, safe to re-run.
|
||||
*/
|
||||
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TYPE "public"."enum_minigames_status" ADD VALUE IF NOT EXISTS 'phasingOut';
|
||||
`);
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "minigames" ADD COLUMN "estimated_removal_date" timestamp(3) with time zone;
|
||||
`);
|
||||
}
|
||||
|
||||
// Postgres cannot remove values from an enum type; down drops the column only.
|
||||
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "minigames" DROP COLUMN "estimated_removal_date";
|
||||
`);
|
||||
}
|
||||
|
|
@ -136,6 +136,7 @@ import * as migration_20261013_183041_add_journal_contribution_type from './2026
|
|||
import * as migration_20261013_184745_add_garage_fields from './20261013_184745_add_garage_fields';
|
||||
import * as migration_20261014_134620_add_analytics_tables from './20261014_134620_add_analytics_tables';
|
||||
import * as migration_20261014_135614_add_analytics_permission_enum_value from './20261014_135614_add_analytics_permission_enum_value';
|
||||
import * as migration_20261014_140500_add_minigame_phasing_out_status from './20261014_140500_add_minigame_phasing_out_status';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -828,4 +829,9 @@ export const migrations = [
|
|||
down: migration_20261014_135614_add_analytics_permission_enum_value.down,
|
||||
name: '20261014_135614_add_analytics_permission_enum_value'
|
||||
},
|
||||
{
|
||||
up: migration_20261014_140500_add_minigame_phasing_out_status.up,
|
||||
down: migration_20261014_140500_add_minigame_phasing_out_status.down,
|
||||
name: '20261014_140500_add_minigame_phasing_out_status'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -130,6 +130,16 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
|||
"awards:update",
|
||||
"awards:delete",
|
||||
"admin:awards:manage",
|
||||
"journals:create",
|
||||
"journals:read",
|
||||
"journals:update",
|
||||
"journals:delete",
|
||||
"admin:journals:manage",
|
||||
"award-rules:create",
|
||||
"award-rules:read",
|
||||
"award-rules:update",
|
||||
"award-rules:delete",
|
||||
"admin:award-rules:manage",
|
||||
"qualifications:create",
|
||||
"qualifications:read",
|
||||
"qualifications:update",
|
||||
|
|
@ -444,6 +454,8 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
|||
"tickets:staff",
|
||||
"discord:staff",
|
||||
"discord:announce",
|
||||
"discord:rp:read",
|
||||
"discord:rp:update",
|
||||
"custom-minefields:update",
|
||||
"custom-minefields:delete",
|
||||
"custom-minefield-scores:delete",
|
||||
|
|
@ -471,6 +483,7 @@ export const enum_game_event_logs_required_permissions = pgEnum(
|
|||
"achievements:update",
|
||||
"achievements:delete",
|
||||
"admin:achievements:manage",
|
||||
"admin:analytics:manage",
|
||||
],
|
||||
);
|
||||
export const enum_game_event_logs_visibility = pgEnum("enum_game_event_logs_visibility", [
|
||||
|
|
@ -516,6 +529,8 @@ export const enum_game_event_logs_target_collection = pgEnum(
|
|||
"voice-scripts",
|
||||
"voice-submissions",
|
||||
"story-beats",
|
||||
"journals",
|
||||
"awards",
|
||||
"story-beat-states",
|
||||
"custom-minefields",
|
||||
"custom-minefield-scores",
|
||||
|
|
@ -635,6 +650,16 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
|||
"awards:update",
|
||||
"awards:delete",
|
||||
"admin:awards:manage",
|
||||
"journals:create",
|
||||
"journals:read",
|
||||
"journals:update",
|
||||
"journals:delete",
|
||||
"admin:journals:manage",
|
||||
"award-rules:create",
|
||||
"award-rules:read",
|
||||
"award-rules:update",
|
||||
"award-rules:delete",
|
||||
"admin:award-rules:manage",
|
||||
"qualifications:create",
|
||||
"qualifications:read",
|
||||
"qualifications:update",
|
||||
|
|
@ -949,6 +974,8 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
|||
"tickets:staff",
|
||||
"discord:staff",
|
||||
"discord:announce",
|
||||
"discord:rp:read",
|
||||
"discord:rp:update",
|
||||
"custom-minefields:update",
|
||||
"custom-minefields:delete",
|
||||
"custom-minefield-scores:delete",
|
||||
|
|
@ -976,6 +1003,7 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
|||
"achievements:update",
|
||||
"achievements:delete",
|
||||
"admin:achievements:manage",
|
||||
"admin:analytics:manage",
|
||||
]);
|
||||
export const enum_awards_grant_config_allowed_grantor_assignment_types = pgEnum(
|
||||
"enum_awards_grant_config_allowed_grantor_assignment_types",
|
||||
|
|
@ -986,6 +1014,13 @@ export const enum_awards_grant_config_recipient_scope = pgEnum(
|
|||
"enum_awards_grant_config_recipient_scope",
|
||||
["same_command", "whitelist", "anyone"],
|
||||
);
|
||||
export const enum_award_rules_metric = pgEnum("enum_award_rules_metric", [
|
||||
"yearsOfService",
|
||||
"accountAge",
|
||||
"missionsAttended",
|
||||
"xpTotal",
|
||||
]);
|
||||
export const enum_award_rules_operator = pgEnum("enum_award_rules_operator", ["gte", "gt"]);
|
||||
export const enum_assignments_type = pgEnum("enum_assignments_type", [
|
||||
"division",
|
||||
"squad",
|
||||
|
|
@ -1017,6 +1052,7 @@ export const enum_contribution_entries_type = pgEnum("enum_contribution_entries_
|
|||
"wiki-page-edit",
|
||||
"mission-map-marker",
|
||||
"survey-completion",
|
||||
"journal-publish",
|
||||
"manual",
|
||||
]);
|
||||
export const enum_contribution_entries_status = pgEnum("enum_contribution_entries_status", [
|
||||
|
|
@ -1027,7 +1063,7 @@ export const enum_contribution_entries_status = pgEnum("enum_contribution_entrie
|
|||
]);
|
||||
export const enum_contribution_entries_source_collection = pgEnum(
|
||||
"enum_contribution_entries_source_collection",
|
||||
["wiki-pages", "mission-map-markers", "form-submissions", "manual"],
|
||||
["wiki-pages", "mission-map-markers", "form-submissions", "journals", "manual"],
|
||||
);
|
||||
export const enum_evaluations_kind = pgEnum("enum_evaluations_kind", [
|
||||
"leader-direct",
|
||||
|
|
@ -1477,6 +1513,7 @@ export const enum_story_beat_states_reaction = pgEnum("enum_story_beat_states_re
|
|||
"heart",
|
||||
"salute",
|
||||
]);
|
||||
export const enum_journals_status = pgEnum("enum_journals_status", ["draft", "published"]);
|
||||
export const enum_game_servers_status = pgEnum("enum_game_servers_status", ["online", "offline"]);
|
||||
export const enum_arma_commands_status = pgEnum("enum_arma_commands_status", [
|
||||
"queued",
|
||||
|
|
@ -1534,6 +1571,7 @@ export const enum_minigames_status = pgEnum("enum_minigames_status", [
|
|||
"active",
|
||||
"upcoming",
|
||||
"retired",
|
||||
"phasingOut",
|
||||
]);
|
||||
export const enum_minigame_periods_status = pgEnum("enum_minigame_periods_status", [
|
||||
"open",
|
||||
|
|
@ -1589,6 +1627,14 @@ export const enum_shims_shims_paths_match_type = pgEnum("enum_shims_shims_paths_
|
|||
"include",
|
||||
"exclude",
|
||||
]);
|
||||
export const enum_discord_presence_activity_type = pgEnum("enum_discord_presence_activity_type", [
|
||||
"playing",
|
||||
"streaming",
|
||||
"listening",
|
||||
"watching",
|
||||
"competing",
|
||||
"custom",
|
||||
]);
|
||||
|
||||
export const media = pgTable(
|
||||
"media",
|
||||
|
|
@ -2148,6 +2194,10 @@ export const game_vehicles = pgTable(
|
|||
deployedAt: integer("deployed_at_id").references(() => game_structures.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
garageGridX: numeric("garage_grid_x", { mode: "number" }),
|
||||
garageGridY: numeric("garage_grid_y", { mode: "number" }),
|
||||
garageRotated: boolean("garage_rotated").default(false),
|
||||
bridgeUid: varchar("bridge_uid"),
|
||||
faction: integer("faction_id").references(() => factions.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
|
|
@ -2164,6 +2214,7 @@ export const game_vehicles = pgTable(
|
|||
(columns) => [
|
||||
index("game_vehicles_type_idx").on(columns.type),
|
||||
index("game_vehicles_deployed_at_idx").on(columns.deployedAt),
|
||||
uniqueIndex("game_vehicles_bridge_uid_idx").on(columns.bridgeUid),
|
||||
index("game_vehicles_faction_idx").on(columns.faction),
|
||||
index("game_vehicles_updated_at_idx").on(columns.updatedAt),
|
||||
index("game_vehicles_created_at_idx").on(columns.createdAt),
|
||||
|
|
@ -2591,6 +2642,7 @@ export const users = pgTable(
|
|||
preferences_display_showBackgroundTexture: boolean(
|
||||
"preferences_display_show_background_texture",
|
||||
).default(true),
|
||||
preferences_display_sidebarOrder: jsonb("preferences_display_sidebar_order"),
|
||||
preferences_discord_enabled: boolean("preferences_discord_enabled").default(false),
|
||||
preferences_dashboard_layout: jsonb("preferences_dashboard_layout"),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
|
|
@ -3264,6 +3316,36 @@ export const awards_rels = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const award_rules = pgTable(
|
||||
"award_rules",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
label: varchar("label").notNull(),
|
||||
award: integer("award_id")
|
||||
.notNull()
|
||||
.references(() => awards.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
metric: enum_award_rules_metric("metric").notNull(),
|
||||
operator: enum_award_rules_operator("operator").notNull().default("gte"),
|
||||
value: numeric("value", { mode: "number" }).notNull(),
|
||||
autoRetireLowerTiers: boolean("auto_retire_lower_tiers").default(false),
|
||||
oncePerSeries: boolean("once_per_series").default(false),
|
||||
active: boolean("active").default(true),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
},
|
||||
(columns) => [
|
||||
index("award_rules_award_idx").on(columns.award),
|
||||
index("award_rules_updated_at_idx").on(columns.updatedAt),
|
||||
index("award_rules_created_at_idx").on(columns.createdAt),
|
||||
],
|
||||
);
|
||||
|
||||
export const qualifications = pgTable(
|
||||
"qualifications",
|
||||
{
|
||||
|
|
@ -4861,6 +4943,8 @@ export const vehicles = pgTable(
|
|||
transportMode: enum_vehicles_transport_mode("transport_mode").notNull().default("ground"),
|
||||
width: numeric("width", { mode: "number" }),
|
||||
height: numeric("height", { mode: "number" }),
|
||||
garageWidth: numeric("garage_width", { mode: "number" }),
|
||||
garageHeight: numeric("garage_height", { mode: "number" }),
|
||||
maxMass: numeric("max_mass", { mode: "number" }),
|
||||
aceCargoSlots: numeric("ace_cargo_slots", { mode: "number" }),
|
||||
maxHealth: numeric("max_health", { mode: "number" }),
|
||||
|
|
@ -5291,6 +5375,8 @@ export const structures = pgTable(
|
|||
restrictToAllowed: boolean("restrict_to_allowed").default(false),
|
||||
xSize: numeric("x_size", { mode: "number" }),
|
||||
ySize: numeric("y_size", { mode: "number" }),
|
||||
vehicleBay_xSize: numeric("vehicle_bay_x_size", { mode: "number" }),
|
||||
vehicleBay_ySize: numeric("vehicle_bay_y_size", { mode: "number" }),
|
||||
maxHealth: numeric("max_health", { mode: "number" }).notNull(),
|
||||
repairSpeed: numeric("repair_speed", { mode: "number" }),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
|
|
@ -6666,6 +6752,38 @@ export const story_voiceovers = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const journals = pgTable(
|
||||
"journals",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
title: varchar("title").notNull(),
|
||||
author: integer("author_id")
|
||||
.notNull()
|
||||
.references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
status: enum_journals_status("status").notNull().default("draft"),
|
||||
occurredAt: timestamp("occurred_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
mission: integer("mission_id").references(() => missions.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
body: jsonb("body").notNull(),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
},
|
||||
(columns) => [
|
||||
index("journals_author_idx").on(columns.author),
|
||||
index("journals_status_idx").on(columns.status),
|
||||
index("journals_mission_idx").on(columns.mission),
|
||||
index("journals_updated_at_idx").on(columns.updatedAt),
|
||||
index("journals_created_at_idx").on(columns.createdAt),
|
||||
],
|
||||
);
|
||||
|
||||
export const mission_files = pgTable(
|
||||
"mission_files",
|
||||
{
|
||||
|
|
@ -7333,6 +7451,11 @@ export const minigames = pgTable(
|
|||
withTimezone: true,
|
||||
precision: 3,
|
||||
}),
|
||||
estimatedRemovalDate: timestamp("estimated_removal_date", {
|
||||
mode: "string",
|
||||
withTimezone: true,
|
||||
precision: 3,
|
||||
}),
|
||||
order: numeric("order", { mode: "number" }).notNull().default(0),
|
||||
countsForPeriods: boolean("counts_for_periods").default(false),
|
||||
scoreLabel: varchar("score_label").default("Score"),
|
||||
|
|
@ -8061,6 +8184,10 @@ export const payload_mcp_api_keys = pgTable(
|
|||
awards_create: boolean("awards_create").default(false),
|
||||
awards_update: boolean("awards_update").default(false),
|
||||
awards_delete: boolean("awards_delete").default(false),
|
||||
awardRules_find: boolean("award_rules_find").default(false),
|
||||
awardRules_create: boolean("award_rules_create").default(false),
|
||||
awardRules_update: boolean("award_rules_update").default(false),
|
||||
awardRules_delete: boolean("award_rules_delete").default(false),
|
||||
qualifications_find: boolean("qualifications_find").default(false),
|
||||
qualifications_create: boolean("qualifications_create").default(false),
|
||||
qualifications_update: boolean("qualifications_update").default(false),
|
||||
|
|
@ -8261,6 +8388,10 @@ export const payload_mcp_api_keys = pgTable(
|
|||
storyVoiceovers_create: boolean("story_voiceovers_create").default(false),
|
||||
storyVoiceovers_update: boolean("story_voiceovers_update").default(false),
|
||||
storyVoiceovers_delete: boolean("story_voiceovers_delete").default(false),
|
||||
journals_find: boolean("journals_find").default(false),
|
||||
journals_create: boolean("journals_create").default(false),
|
||||
journals_update: boolean("journals_update").default(false),
|
||||
journals_delete: boolean("journals_delete").default(false),
|
||||
missionFiles_find: boolean("mission_files_find").default(false),
|
||||
missionFiles_create: boolean("mission_files_create").default(false),
|
||||
missionFiles_update: boolean("mission_files_update").default(false),
|
||||
|
|
@ -8411,6 +8542,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
ranksID: integer("ranks_id"),
|
||||
profilesID: integer("profiles_id"),
|
||||
awardsID: integer("awards_id"),
|
||||
"award-rulesID": integer("award_rules_id"),
|
||||
qualificationsID: integer("qualifications_id"),
|
||||
assignmentsID: integer("assignments_id"),
|
||||
"assignment-transfersID": integer("assignment_transfers_id"),
|
||||
|
|
@ -8461,6 +8593,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
"story-beatsID": integer("story_beats_id"),
|
||||
"story-beat-statesID": integer("story_beat_states_id"),
|
||||
"story-voiceoversID": integer("story_voiceovers_id"),
|
||||
journalsID: integer("journals_id"),
|
||||
"mission-filesID": integer("mission_files_id"),
|
||||
"mod-listsID": integer("mod_lists_id"),
|
||||
"game-serversID": integer("game_servers_id"),
|
||||
|
|
@ -8513,6 +8646,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
index("payload_locked_documents_rels_ranks_id_idx").on(columns.ranksID),
|
||||
index("payload_locked_documents_rels_profiles_id_idx").on(columns.profilesID),
|
||||
index("payload_locked_documents_rels_awards_id_idx").on(columns.awardsID),
|
||||
index("payload_locked_documents_rels_award_rules_id_idx").on(columns["award-rulesID"]),
|
||||
index("payload_locked_documents_rels_qualifications_id_idx").on(columns.qualificationsID),
|
||||
index("payload_locked_documents_rels_assignments_id_idx").on(columns.assignmentsID),
|
||||
index("payload_locked_documents_rels_assignment_transfers_id_idx").on(
|
||||
|
|
@ -8593,6 +8727,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
index("payload_locked_documents_rels_story_voiceovers_id_idx").on(
|
||||
columns["story-voiceoversID"],
|
||||
),
|
||||
index("payload_locked_documents_rels_journals_id_idx").on(columns.journalsID),
|
||||
index("payload_locked_documents_rels_mission_files_id_idx").on(columns["mission-filesID"]),
|
||||
index("payload_locked_documents_rels_mod_lists_id_idx").on(columns["mod-listsID"]),
|
||||
index("payload_locked_documents_rels_game_servers_id_idx").on(columns["game-serversID"]),
|
||||
|
|
@ -8735,6 +8870,11 @@ export const payload_locked_documents_rels = pgTable(
|
|||
foreignColumns: [awards.id],
|
||||
name: "payload_locked_documents_rels_awards_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["award-rulesID"]],
|
||||
foreignColumns: [award_rules.id],
|
||||
name: "payload_locked_documents_rels_award_rules_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["qualificationsID"]],
|
||||
foreignColumns: [qualifications.id],
|
||||
|
|
@ -8985,6 +9125,11 @@ export const payload_locked_documents_rels = pgTable(
|
|||
foreignColumns: [story_voiceovers.id],
|
||||
name: "payload_locked_documents_rels_story_voiceovers_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["journalsID"]],
|
||||
foreignColumns: [journals.id],
|
||||
name: "payload_locked_documents_rels_journals_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["mission-filesID"]],
|
||||
foreignColumns: [mission_files.id],
|
||||
|
|
@ -9378,6 +9523,26 @@ export const minigame_rules = pgTable("minigame_rules", {
|
|||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
});
|
||||
|
||||
export const discord_presence = pgTable("discord_presence", {
|
||||
id: serial("id").primaryKey(),
|
||||
enabled: boolean("enabled").default(false),
|
||||
activityType: enum_discord_presence_activity_type("activity_type").notNull().default("playing"),
|
||||
state: varchar("state"),
|
||||
details: varchar("details"),
|
||||
startTimestamp: numeric("start_timestamp", { mode: "number" }),
|
||||
endTimestamp: numeric("end_timestamp", { mode: "number" }),
|
||||
largeImageKey: varchar("large_image_key"),
|
||||
largeImageText: varchar("large_image_text"),
|
||||
smallImageKey: varchar("small_image_key"),
|
||||
smallImageText: varchar("small_image_text"),
|
||||
partyId: varchar("party_id"),
|
||||
partySize: numeric("party_size", { mode: "number" }),
|
||||
partyMax: numeric("party_max", { mode: "number" }),
|
||||
joinSecret: varchar("join_secret"),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
});
|
||||
|
||||
export const relations_media = relations(media, () => ({}));
|
||||
export const relations_announcements_buttons = relations(announcements_buttons, ({ one }) => ({
|
||||
_parentID: one(announcements, {
|
||||
|
|
@ -9996,6 +10161,13 @@ export const relations_awards = relations(awards, ({ one, many }) => ({
|
|||
relationName: "_rels",
|
||||
}),
|
||||
}));
|
||||
export const relations_award_rules = relations(award_rules, ({ one }) => ({
|
||||
award: one(awards, {
|
||||
fields: [award_rules.award],
|
||||
references: [awards.id],
|
||||
relationName: "award",
|
||||
}),
|
||||
}));
|
||||
export const relations_qualifications = relations(qualifications, () => ({}));
|
||||
export const relations_assignments_rels = relations(assignments_rels, ({ one }) => ({
|
||||
parent: one(assignments, {
|
||||
|
|
@ -11538,6 +11710,18 @@ export const relations_story_beat_states = relations(story_beat_states, ({ one }
|
|||
}),
|
||||
}));
|
||||
export const relations_story_voiceovers = relations(story_voiceovers, () => ({}));
|
||||
export const relations_journals = relations(journals, ({ one }) => ({
|
||||
author: one(users, {
|
||||
fields: [journals.author],
|
||||
references: [users.id],
|
||||
relationName: "author",
|
||||
}),
|
||||
mission: one(missions, {
|
||||
fields: [journals.mission],
|
||||
references: [missions.id],
|
||||
relationName: "mission",
|
||||
}),
|
||||
}));
|
||||
export const relations_mission_files = relations(mission_files, ({ one }) => ({
|
||||
author: one(users, {
|
||||
fields: [mission_files.author],
|
||||
|
|
@ -12129,6 +12313,11 @@ export const relations_payload_locked_documents_rels = relations(
|
|||
references: [awards.id],
|
||||
relationName: "awards",
|
||||
}),
|
||||
"award-rulesID": one(award_rules, {
|
||||
fields: [payload_locked_documents_rels["award-rulesID"]],
|
||||
references: [award_rules.id],
|
||||
relationName: "award-rules",
|
||||
}),
|
||||
qualificationsID: one(qualifications, {
|
||||
fields: [payload_locked_documents_rels.qualificationsID],
|
||||
references: [qualifications.id],
|
||||
|
|
@ -12379,6 +12568,11 @@ export const relations_payload_locked_documents_rels = relations(
|
|||
references: [story_voiceovers.id],
|
||||
relationName: "story-voiceovers",
|
||||
}),
|
||||
journalsID: one(journals, {
|
||||
fields: [payload_locked_documents_rels.journalsID],
|
||||
references: [journals.id],
|
||||
relationName: "journals",
|
||||
}),
|
||||
"mission-filesID": one(mission_files, {
|
||||
fields: [payload_locked_documents_rels["mission-filesID"]],
|
||||
references: [mission_files.id],
|
||||
|
|
@ -12618,6 +12812,7 @@ export const relations_shims = relations(shims, ({ many }) => ({
|
|||
}),
|
||||
}));
|
||||
export const relations_minigame_rules = relations(minigame_rules, () => ({}));
|
||||
export const relations_discord_presence = relations(discord_presence, () => ({}));
|
||||
|
||||
type DatabaseSchema = {
|
||||
enum_announcements_buttons_style: typeof enum_announcements_buttons_style;
|
||||
|
|
@ -12644,6 +12839,8 @@ type DatabaseSchema = {
|
|||
enum_awards_grant_config_allowed_grantor_assignment_types: typeof enum_awards_grant_config_allowed_grantor_assignment_types;
|
||||
enum_awards_type: typeof enum_awards_type;
|
||||
enum_awards_grant_config_recipient_scope: typeof enum_awards_grant_config_recipient_scope;
|
||||
enum_award_rules_metric: typeof enum_award_rules_metric;
|
||||
enum_award_rules_operator: typeof enum_award_rules_operator;
|
||||
enum_assignments_type: typeof enum_assignments_type;
|
||||
enum_assignment_transfers_status: typeof enum_assignment_transfers_status;
|
||||
enum_assignment_transfers_escalation_reason: typeof enum_assignment_transfers_escalation_reason;
|
||||
|
|
@ -12731,6 +12928,7 @@ type DatabaseSchema = {
|
|||
enum_narrative_events_triggers_type: typeof enum_narrative_events_triggers_type;
|
||||
enum_story_beats_status: typeof enum_story_beats_status;
|
||||
enum_story_beat_states_reaction: typeof enum_story_beat_states_reaction;
|
||||
enum_journals_status: typeof enum_journals_status;
|
||||
enum_game_servers_status: typeof enum_game_servers_status;
|
||||
enum_arma_commands_status: typeof enum_arma_commands_status;
|
||||
enum_supply_boxes_status: typeof enum_supply_boxes_status;
|
||||
|
|
@ -12755,6 +12953,7 @@ type DatabaseSchema = {
|
|||
enum_shims_shims_type: typeof enum_shims_shims_type;
|
||||
enum_shims_shims_targeting_audience: typeof enum_shims_shims_targeting_audience;
|
||||
enum_shims_shims_paths_match_type: typeof enum_shims_shims_paths_match_type;
|
||||
enum_discord_presence_activity_type: typeof enum_discord_presence_activity_type;
|
||||
media: typeof media;
|
||||
announcements_buttons: typeof announcements_buttons;
|
||||
announcements: typeof announcements;
|
||||
|
|
@ -12802,6 +13001,7 @@ type DatabaseSchema = {
|
|||
awards_grant_config_allowed_grantor_assignment_types: typeof awards_grant_config_allowed_grantor_assignment_types;
|
||||
awards: typeof awards;
|
||||
awards_rels: typeof awards_rels;
|
||||
award_rules: typeof award_rules;
|
||||
qualifications: typeof qualifications;
|
||||
assignments: typeof assignments;
|
||||
assignments_rels: typeof assignments_rels;
|
||||
|
|
@ -12906,6 +13106,7 @@ type DatabaseSchema = {
|
|||
story_beats: typeof story_beats;
|
||||
story_beat_states: typeof story_beat_states;
|
||||
story_voiceovers: typeof story_voiceovers;
|
||||
journals: typeof journals;
|
||||
mission_files: typeof mission_files;
|
||||
mod_lists: typeof mod_lists;
|
||||
game_servers: typeof game_servers;
|
||||
|
|
@ -12964,6 +13165,7 @@ type DatabaseSchema = {
|
|||
shims_texts: typeof shims_texts;
|
||||
shims_rels: typeof shims_rels;
|
||||
minigame_rules: typeof minigame_rules;
|
||||
discord_presence: typeof discord_presence;
|
||||
relations_media: typeof relations_media;
|
||||
relations_announcements_buttons: typeof relations_announcements_buttons;
|
||||
relations_announcements_texts: typeof relations_announcements_texts;
|
||||
|
|
@ -13011,6 +13213,7 @@ type DatabaseSchema = {
|
|||
relations_awards_grant_config_allowed_grantor_assignment_types: typeof relations_awards_grant_config_allowed_grantor_assignment_types;
|
||||
relations_awards_rels: typeof relations_awards_rels;
|
||||
relations_awards: typeof relations_awards;
|
||||
relations_award_rules: typeof relations_award_rules;
|
||||
relations_qualifications: typeof relations_qualifications;
|
||||
relations_assignments_rels: typeof relations_assignments_rels;
|
||||
relations_assignments: typeof relations_assignments;
|
||||
|
|
@ -13115,6 +13318,7 @@ type DatabaseSchema = {
|
|||
relations_story_beats: typeof relations_story_beats;
|
||||
relations_story_beat_states: typeof relations_story_beat_states;
|
||||
relations_story_voiceovers: typeof relations_story_voiceovers;
|
||||
relations_journals: typeof relations_journals;
|
||||
relations_mission_files: typeof relations_mission_files;
|
||||
relations_mod_lists: typeof relations_mod_lists;
|
||||
relations_game_servers: typeof relations_game_servers;
|
||||
|
|
@ -13173,6 +13377,7 @@ type DatabaseSchema = {
|
|||
relations_shims_rels: typeof relations_shims_rels;
|
||||
relations_shims: typeof relations_shims;
|
||||
relations_minigame_rules: typeof relations_minigame_rules;
|
||||
relations_discord_presence: typeof relations_discord_presence;
|
||||
};
|
||||
|
||||
declare module "@payloadcms/db-postgres" {
|
||||
|
|
|
|||
|
|
@ -6171,11 +6171,15 @@ export interface Minigame {
|
|||
*/
|
||||
icon?: string | null;
|
||||
category: 'core' | 'cardtable' | 'multiplayer';
|
||||
status: 'active' | 'upcoming' | 'retired';
|
||||
status: 'active' | 'upcoming' | 'retired' | 'phasingOut';
|
||||
/**
|
||||
* Optional target for an upcoming game. Shown as a countdown in the sidebar and on the game page. Display only: the game goes live when status changes to Active.
|
||||
*/
|
||||
estimatedReleaseDate?: string | null;
|
||||
/**
|
||||
* Optional target for a phasing-out game. Shown as a countdown in the sidebar and on the game page so operators know when it leaves. Display only: the game stays playable until status changes to Retired.
|
||||
*/
|
||||
estimatedRemovalDate?: string | null;
|
||||
order: number;
|
||||
/**
|
||||
* When on, ledger entries for this game feed anchored period boards.
|
||||
|
|
@ -11015,6 +11019,7 @@ export interface MinigamesSelect<T extends boolean = true> {
|
|||
category?: T;
|
||||
status?: T;
|
||||
estimatedReleaseDate?: T;
|
||||
estimatedRemovalDate?: T;
|
||||
order?: T;
|
||||
countsForPeriods?: T;
|
||||
scoreLabel?: T;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
|||
import {
|
||||
formatCountdown,
|
||||
formatReleaseInstant,
|
||||
phasingOutTooltip,
|
||||
upcomingTooltip,
|
||||
} from "@/lib/minigames/countdown";
|
||||
|
||||
|
|
@ -37,4 +38,11 @@ describe("Minigame release countdown", () => {
|
|||
);
|
||||
expect(upcomingTooltip(null)).toBe("Upcoming");
|
||||
});
|
||||
|
||||
it("builds the phasing-out tooltip line, with and without an estimate", () => {
|
||||
expect(phasingOutTooltip(TARGET, new Date(targetMs - (12 * DAY + 3 * HOUR)))).toBe(
|
||||
"Phasing out · leaves Dec 3, 2026 18:00 UTC (in 12d 3h)",
|
||||
);
|
||||
expect(phasingOutTooltip(null)).toBe("Phasing out");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -122,13 +122,36 @@ describe("Minigame registry", () => {
|
|||
expect(achievements.docs[0]?.value).toBe(10);
|
||||
});
|
||||
|
||||
it("keeps a phasing-out game in the nav, scoring, and round-trips its removal date", async () => {
|
||||
await clearMinigameData();
|
||||
await createGame({
|
||||
key: "leaving",
|
||||
label: "Leaving Soon",
|
||||
category: "core",
|
||||
status: "phasingOut",
|
||||
order: 1,
|
||||
countsForPeriods: true,
|
||||
estimatedRemovalDate: "2027-01-15T00:00:00.000Z",
|
||||
});
|
||||
|
||||
const games = await loadMinigameRegistry(payload);
|
||||
const leaving = games.find((game) => game.key === "leaving");
|
||||
// Still visible in the nav (unlike retired) with its removal date attached.
|
||||
expect(leaving?.status).toBe("phasingOut");
|
||||
expect(leaving?.estimatedRemovalDate).toBe("2027-01-15T00:00:00.000Z");
|
||||
expect(visibleRegistryGames(games).map((game) => game.key)).toContain("leaving");
|
||||
// Still scores periods while it is playable.
|
||||
expect(periodScoringGameKeys(games)).toContain("leaving");
|
||||
});
|
||||
|
||||
async function createGame(data: {
|
||||
key: string;
|
||||
label: string;
|
||||
category: "core" | "cardtable";
|
||||
status: "active" | "retired" | "upcoming";
|
||||
status: "active" | "retired" | "upcoming" | "phasingOut";
|
||||
order: number;
|
||||
countsForPeriods?: boolean;
|
||||
estimatedRemovalDate?: string;
|
||||
}) {
|
||||
await payload.create({
|
||||
collection: "minigames",
|
||||
|
|
|
|||
|
|
@ -69,12 +69,36 @@ describe("Upcoming minigames", () => {
|
|||
expect(keys).not.toContain("signals");
|
||||
});
|
||||
|
||||
it("keeps a phasing-out game playable: round-trips the removal date and leaderboard row", async () => {
|
||||
await clearMinigameData();
|
||||
await createGame({
|
||||
key: "retire-me",
|
||||
label: "Retire Me",
|
||||
status: "phasingOut",
|
||||
order: 1,
|
||||
estimatedRemovalDate: RELEASE,
|
||||
});
|
||||
|
||||
const games = await loadMinigameRegistry(payload);
|
||||
const leaving = games.find((game) => game.key === "retire-me");
|
||||
expect(leaving?.estimatedRemovalDate).toBe(RELEASE);
|
||||
|
||||
// Not a coming-soon gate: it renders the arena rather than the coming-soon screen.
|
||||
const gate = await getMinigameReleaseState(payload, "retire-me");
|
||||
expect(gate.upcoming).toBe(false);
|
||||
|
||||
// Still scores periods while it is playable.
|
||||
const data = await buildLeaderboardPayload(payload, { scope: "period" });
|
||||
expect(data.boards.map((board) => board.key)).toContain("retire-me");
|
||||
});
|
||||
|
||||
async function createGame(data: {
|
||||
key: string;
|
||||
label: string;
|
||||
status: "active" | "upcoming" | "retired";
|
||||
status: "active" | "upcoming" | "retired" | "phasingOut";
|
||||
order: number;
|
||||
estimatedReleaseDate?: string;
|
||||
estimatedRemovalDate?: string;
|
||||
}) {
|
||||
await payload.create({
|
||||
collection: "minigames",
|
||||
|
|
|
|||
Loading…
Reference in a new issue