1
0
Fork 0
polaris-task-force/src/collections/server/RespawnTickets.ts
Z8MB1E 7ad9320c02 feat(respawn-tickets): settle attendance-based respawn tickets per mission
Tickets collection, settlement service, arma-bridge API route, one-shot ticketsSettledAt marker on missions, migration, and tests.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-14 15:37:05 -04:00

35 lines
1.3 KiB
TypeScript

import { CollectionConfig } from "payload";
/**
* Per-player respawn ticket balances. Tickets are awarded automatically when a
* mission is "settled" (see src/lib/respawn-tickets/index.ts): each attendee
* earns 1 ticket for a "yes" RSVP, 0.5 for "tentative", 0.25 for "no", and
* nothing when they attend without an RSVP. Balances accumulate across
* missions and are served to the Arma 3 mod via the arma-bridge tickets
* route, which loads them into the game at mission start.
*
* Written internally by the settlement lib (overrideAccess); the admin panel
* is read-only so balance changes always have a settlement behind them.
*/
export const RespawnTickets: CollectionConfig = {
slug: "respawn-tickets",
admin: { group: "Server", useAsTitle: "user", defaultColumns: ["user", "balance"] },
access: {
read: ({ req }) => !!req.user,
create: () => false,
update: () => false,
delete: () => false,
},
fields: [
{ name: "user", type: "relationship", relationTo: "users", required: true, unique: true, index: true },
{
name: "balance",
type: "number",
defaultValue: 0,
admin: {
description:
"Accumulated respawn tickets (1 per yes-attended op, 0.5 tentative, 0.25 no). Maintained by settlement; read-only.",
},
},
],
};