feat: complete general turn lifecycle

This commit is contained in:
2026-07-25 08:42:57 +00:00
parent 88afcb5465
commit 45ba960474
13 changed files with 1412 additions and 30 deletions
+14
View File
@@ -179,6 +179,20 @@ model General {
@@map("general")
}
model GeneralAccessLog {
id Int @id @default(autoincrement())
generalId Int @unique @map("general_id")
userId String? @map("user_id")
lastRefresh DateTime? @map("last_refresh")
refresh Int @default(0)
refreshTotal Int @default(0) @map("refresh_total")
refreshScore Int @default(0) @map("refresh_score")
refreshScoreTotal Int @default(0) @map("refresh_score_total")
@@index([userId])
@@map("general_access_log")
}
model RankData {
id Int @id @default(autoincrement())
nationId Int @default(0) @map("nation_id")
@@ -0,0 +1,13 @@
CREATE TABLE "general_access_log" (
"id" SERIAL PRIMARY KEY,
"general_id" INTEGER NOT NULL,
"user_id" TEXT,
"last_refresh" TIMESTAMP(3),
"refresh" INTEGER NOT NULL DEFAULT 0,
"refresh_total" INTEGER NOT NULL DEFAULT 0,
"refresh_score" INTEGER NOT NULL DEFAULT 0,
"refresh_score_total" INTEGER NOT NULL DEFAULT 0
);
CREATE UNIQUE INDEX "general_access_log_general_id_key" ON "general_access_log"("general_id");
CREATE INDEX "general_access_log_user_id_idx" ON "general_access_log"("user_id");
+1
View File
@@ -6,6 +6,7 @@ export interface DatabaseClient {
$executeRaw: GamePrismaClient['$executeRaw'];
worldState: GamePrisma.WorldStateDelegate;
general: GamePrisma.GeneralDelegate;
generalAccessLog: GamePrisma.GeneralAccessLogDelegate;
city: GamePrisma.CityDelegate;
nation: GamePrisma.NationDelegate;
diplomacy: GamePrisma.DiplomacyDelegate;
+6
View File
@@ -16,6 +16,7 @@ export interface TurnEngineWorldStateRow {
export interface TurnEngineGeneralRow {
id: number;
userId: string | null;
name: string;
nationId: number;
cityId: number;
@@ -42,6 +43,9 @@ export interface TurnEngineGeneralRow {
atmos: number;
age: number;
npcState: number;
bornYear: number;
deadYear: number;
affinity: number | null;
meta: JsonValue;
turnTime: Date;
recentWarTime: Date | null;
@@ -140,6 +144,7 @@ export interface TurnEngineWorldStateCreateInput {
}
export interface TurnEngineGeneralUpdateInput {
userId: string | null;
name: string;
nationId: number;
cityId: number;
@@ -264,6 +269,7 @@ export interface TurnEngineNationUpdateInput {
name: string;
color: string;
capitalCityId: number | null;
chiefGeneralId: number | null;
gold: number;
rice: number;
level: number;