feat: 오픈 게임 취소와 유산 정산 경로 추가

별도 최고위험 권한으로 실행되는 원자적 취소 작업을 추가한다. 버려진 게임과 장수 기록의 보존·삭제 옵션, 오픈 원금 전액 환급 및 획득 포인트 보전율, 취소 상태와 관리자·과거기록 UI를 함께 반영한다.
This commit is contained in:
2026-08-18 13:31:49 +00:00
parent a7b11811de
commit 383d173790
36 changed files with 1967 additions and 83 deletions
@@ -439,6 +439,7 @@ export const seedScenarioToDatabase = async (options: ScenarioSeedOptions): Prom
: 1,
scenario: options.scenarioId,
scenarioName: String(seed.scenarioMeta?.title ?? ''),
status: 'OPEN',
env: asJson({
config: scenarioConfig,
meta: archivedWorldMeta,
@@ -454,12 +455,33 @@ export const seedScenarioToDatabase = async (options: ScenarioSeedOptions): Prom
: 1,
scenario: options.scenarioId,
scenarioName: String(seed.scenarioMeta?.title ?? ''),
status: 'OPEN',
env: asJson({
config: scenarioConfig,
meta: archivedWorldMeta,
}),
},
});
const openingPointRows = await prisma.inheritancePoint.findMany({
select: { userId: true, value: true },
orderBy: { id: 'asc' },
});
const openingPoints = new Map<string, number>();
for (const row of openingPointRows) {
openingPoints.set(row.userId, (openingPoints.get(row.userId) ?? 0) + row.value);
}
if (openingPoints.size > 0) {
await prisma.gameInheritanceBaseline.createMany({
data: Array.from(openingPoints, ([userId, openingPoint]) => ({
serverId: worldMeta.serverId as string,
userId,
openingPoint: Math.trunc(openingPoint),
source: 'OPENING',
})),
skipDuplicates: true,
});
}
}
if (seed.nations.length > 0) {