feat: Zod를 사용한 월드 상태 구성 및 메타 타입 추가, 사용자 ID 처리 개선

This commit is contained in:
2026-01-05 14:49:19 +00:00
parent 4391110ab0
commit 1861cbc9c6
17 changed files with 118 additions and 153 deletions
+18 -1
View File
@@ -1,3 +1,4 @@
import { z } from 'zod';
import type { GameSessionTokenPayload } from '@sammo-ts/common';
import type { DatabaseClient as InfraDatabaseClient, RedisConnector } from '@sammo-ts/infra';
@@ -10,6 +11,21 @@ export interface GameProfile {
name: string;
}
export const zWorldStateConfig = z.object({
maxUserCnt: z.number().optional(),
fictionMode: z.string().optional(),
});
export type WorldStateConfig = z.infer<typeof zWorldStateConfig>;
export const zWorldStateMeta = z.object({
starttime: z.string().optional(),
opentime: z.string().optional(),
turntime: z.string().optional(),
otherTextInfo: z.string().optional(),
isUnited: z.number().optional(),
});
export type WorldStateMeta = z.infer<typeof zWorldStateMeta>;
export interface WorldStateRow {
scenarioCode: string;
currentYear: number;
@@ -22,7 +38,7 @@ export interface WorldStateRow {
export interface GeneralRow {
id: number;
userId: number | null;
userId: string | null;
name: string;
nationId: number;
cityId: number;
@@ -49,6 +65,7 @@ export interface GeneralRow {
atmos: number;
age: number;
npcState: number;
picture: string | null;
meta: unknown;
}