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
+10 -12
View File
@@ -1,4 +1,5 @@
import { asNumber, asRecord } from '@sammo-ts/common';
import { GamePrisma } from '@sammo-ts/infra';
import type { DatabaseClient, WorldStateRow, InputJsonValue } from '../context.js';
export type InheritPointKey =
@@ -116,18 +117,15 @@ export const readInheritancePoint = async (
userId: string,
key: InheritPointKey
): Promise<number> => {
const row = await db.inheritancePoint.findUnique({
where: {
userId_key: {
userId,
key,
},
},
select: {
value: true,
},
});
return row?.value ?? 0;
const rows = await db.$queryRaw<Array<{ value: number }>>(
GamePrisma.sql`
SELECT value
FROM inheritance_point
WHERE user_id = ${userId} AND key = ${key}
FOR UPDATE
`
);
return rows[0]?.value ?? 0;
};
export const setInheritancePoint = async (