feat: complete legacy-compatible auction system

This commit is contained in:
2026-07-25 10:43:49 +00:00
parent 26c3d5ce16
commit 93ae4df519
21 changed files with 1355 additions and 216 deletions
+6 -3
View File
@@ -2,7 +2,7 @@ import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { randomBytes } from 'node:crypto';
import type { WorldStateRow } from '../../context.js';
import type { DatabaseClient, WorldStateRow } from '../../context.js';
import { authedProcedure, router } from '../../trpc.js';
import { asNumber, asRecord, asStringArray, LiteHashDRBG } from '@sammo-ts/common';
import {
@@ -361,7 +361,7 @@ export const joinRouter = router({
? input.character
: 'None';
return ctx.db.$transaction!(async (db) => {
const createGeneral = async (db: DatabaseClient) => {
const existing = await db.general.findFirst({ where: { userId } });
if (existing) {
throw new TRPCError({
@@ -514,6 +514,7 @@ export const joinRouter = router({
meta: {
createdBy: 'join',
ownerName: ctx.auth?.user.displayName ?? '',
killturn: 24,
},
},
});
@@ -526,7 +527,9 @@ export const joinRouter = router({
}
return { ok: true, generalId: general.id };
});
};
return ctx.db.$transaction ? ctx.db.$transaction(createGeneral) : createGeneral(ctx.db);
}),
listPossessCandidates: authedProcedure
.input(