feat: 플레이 감사 장수 로그를 기수별로 조회

This commit is contained in:
2026-09-16 04:03:14 +00:00
parent 69a61b317c
commit 31c5927449
20 changed files with 437 additions and 21 deletions
+8 -3
View File
@@ -619,7 +619,8 @@ const persistNationBettingOpen = async (
const persistNationBettingFinish = async (
prisma: GamePrisma.TransactionClient,
finish: PendingNationBettingFinish,
recordsFinalized: boolean
recordsFinalized: boolean,
serverId: string | null
): Promise<void> => {
await prisma.$queryRaw`
SELECT id
@@ -752,6 +753,7 @@ const persistNationBettingFinish = async (
if (finishLog) {
await prisma.logEntry.create({
data: {
serverId,
scope: finishLog.scope,
category: finishLog.category,
subType: finishLog.subType ?? null,
@@ -1026,7 +1028,7 @@ const buildDiplomacyUpdate = (
const buildLogCreateData = (
entry: LogEntryDraft,
context: { year: number; month: number; at: Date }
context: { year: number; month: number; at: Date; serverId: string | null }
): TurnEngineLogEntryCreateManyInput | null => {
const record = finalizeLogEntry(entry, {
year: context.year,
@@ -1038,6 +1040,7 @@ const buildLogCreateData = (
}
return {
serverId: context.serverId,
scope: record.scope,
category: record.category,
subType: record.subType ?? null,
@@ -1194,6 +1197,8 @@ export const createDatabaseTurnHooks = async (
})
)?.id ?? 0;
const logContext = {
serverId:
typeof state.meta.serverId === 'string' && state.meta.serverId.trim() ? state.meta.serverId : null,
year: state.currentYear,
month: state.currentMonth,
at: state.lastTurnTime,
@@ -1474,7 +1479,7 @@ export const createDatabaseTurnHooks = async (
await persistNationBettingOpen(prisma, betting);
}
for (const finish of pendingNationBettingFinishes) {
await persistNationBettingFinish(prisma, finish, recordsFinalized);
await persistNationBettingFinish(prisma, finish, recordsFinalized, logContext.serverId);
}
const meta = asRecord(state.meta);
@@ -669,7 +669,9 @@ const appendSelectionLogs = async (options: {
generalText: string;
globalText: string;
}): Promise<void> => {
const serverId = asRecord(options.worldState.meta).serverId;
const common = {
serverId: typeof serverId === 'string' && serverId.trim() ? serverId : null,
year: options.worldState.currentYear,
month: options.worldState.currentMonth,
nationId: null,