feat: 외교 문서 변경을 입력 원장과 함께 감사 이력으로 저장

This commit is contained in:
2026-09-16 05:46:11 +00:00
parent 8faab62866
commit b9d9b63b14
15 changed files with 576 additions and 45 deletions
@@ -20,6 +20,18 @@ export const prunePreviousAuditBatch = async (
if (!lock?.locked) return { status: 'busy', deleted: 0 };
const world = await tx.worldState.findFirst({ orderBy: { id: 'asc' }, select: { meta: true } });
if (asRecord(world?.meta).serverId !== expectedServerId) return { status: 'identityChanged', deleted: 0 };
const diplomacyEvents = await tx.playAuditDiplomacyEvent.findMany({
where: { serverId: { not: expectedServerId } },
orderBy: { sequence: 'asc' },
take: AUDIT_RETENTION_BATCH_SIZE,
select: { id: true },
});
if (diplomacyEvents.length) {
const deleted = await tx.playAuditDiplomacyEvent.deleteMany({
where: { id: { in: diplomacyEvents.map((row) => row.id) } },
});
return { status: 'progress', deleted: deleted.count };
}
const policies = await tx.playAuditPolicy.findMany({
where: { serverId: { not: expectedServerId } },
orderBy: { id: 'asc' },