경매 관련 진행 준비

This commit is contained in:
2026-01-22 17:25:39 +00:00
parent de914a5d16
commit b5b761984e
17 changed files with 481 additions and 12 deletions
+12
View File
@@ -69,6 +69,7 @@ export type TurnDaemonCommand =
};
}
| { type: 'dropItem'; requestId?: string; generalId: number; itemType: string }
| { type: 'auctionFinalize'; requestId?: string; auctionId: number }
| {
type: 'changePermission';
requestId?: string;
@@ -87,6 +88,17 @@ export type TurnDaemonCommand =
};
export type TurnDaemonCommandResult =
| {
type: 'auctionFinalize';
ok: true;
auctionId: number;
}
| {
type: 'auctionFinalize';
ok: false;
auctionId: number;
reason: string;
}
| {
type: 'troopJoin';
ok: true;
+51
View File
@@ -24,6 +24,19 @@ enum LogCategory {
USER
}
enum AuctionStatus {
OPEN
FINALIZING
FINISHED
CANCELED
}
enum AuctionType {
BUY_RICE
SELL_RICE
UNIQUE_ITEM
}
model WorldState {
id Int @id @default(autoincrement())
scenarioCode String @map("scenario_code")
@@ -246,6 +259,44 @@ model InheritanceResult {
@@map("inheritance_result")
}
model Auction {
id Int @id @default(autoincrement())
type AuctionType
targetCode String? @map("target_code")
hostGeneralId Int @map("host_general_id")
hostName String? @map("host_name")
detail Json @default(dbgenerated("'{}'::jsonb"))
status AuctionStatus @default(OPEN)
closeAt DateTime @map("close_at")
latestEventId String @default("") @map("latest_event_id")
latestEventAt DateTime @default(now()) @map("latest_event_at")
finalizingAt DateTime? @map("finalizing_at")
finishedAt DateTime? @map("finished_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
bids AuctionBid[]
@@index([status, closeAt])
@@map("auction")
}
model AuctionBid {
id Int @id @default(autoincrement())
auctionId Int @map("auction_id")
generalId Int @map("general_id")
amount Int
eventId String @map("event_id")
eventAt DateTime @map("event_at")
createdAt DateTime @default(now()) @map("created_at")
auction Auction @relation(fields: [auctionId], references: [id], onDelete: Cascade)
@@index([auctionId, amount])
@@index([auctionId, eventAt])
@@map("auction_bid")
}
model InheritanceUserState {
userId String @id @map("user_id")
meta Json @default(dbgenerated("'{}'::jsonb"))
@@ -0,0 +1,34 @@
CREATE TYPE "auction_status" AS ENUM ('OPEN', 'FINALIZING', 'FINISHED', 'CANCELED');
CREATE TYPE "auction_type" AS ENUM ('BUY_RICE', 'SELL_RICE', 'UNIQUE_ITEM');
CREATE TABLE "auction" (
"id" SERIAL PRIMARY KEY,
"type" "auction_type" NOT NULL,
"target_code" TEXT,
"host_general_id" INTEGER NOT NULL,
"host_name" TEXT,
"detail" JSONB NOT NULL DEFAULT '{}'::jsonb,
"status" "auction_status" NOT NULL DEFAULT 'OPEN',
"close_at" TIMESTAMP(3) NOT NULL,
"latest_event_id" TEXT NOT NULL DEFAULT '',
"latest_event_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"finalizing_at" TIMESTAMP(3),
"finished_at" TIMESTAMP(3),
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX "auction_status_close_at_idx" ON "auction"("status", "close_at");
CREATE TABLE "auction_bid" (
"id" SERIAL PRIMARY KEY,
"auction_id" INTEGER NOT NULL REFERENCES "auction"("id") ON DELETE CASCADE,
"general_id" INTEGER NOT NULL,
"amount" INTEGER NOT NULL,
"event_id" TEXT NOT NULL,
"event_at" TIMESTAMP(3) NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX "auction_bid_auction_amount_idx" ON "auction_bid"("auction_id", "amount");
CREATE INDEX "auction_bid_auction_event_at_idx" ON "auction_bid"("auction_id", "event_at");
+1
View File
@@ -3,6 +3,7 @@ import type { GamePrisma, GamePrismaClient } from './gamePrisma.js';
export interface DatabaseClient {
$transaction?: GamePrismaClient['$transaction'];
$queryRaw: GamePrismaClient['$queryRaw'];
$executeRaw: GamePrismaClient['$executeRaw'];
worldState: GamePrisma.WorldStateDelegate;
general: GamePrisma.GeneralDelegate;
city: GamePrisma.CityDelegate;