fix(dynasty): 왕조 이전 기록을 프로필별로 분리

이전 서버 왕조 목록과 직접 상세 조회를 요청 profile로 제한한다. 개발 profile은 fail-closed로 처리하고 API 및 Chromium 회귀 검증을 추가한다.
This commit is contained in:
2026-08-20 15:44:28 +00:00
parent 1431995a41
commit fd90bf1ebb
6 changed files with 110 additions and 38 deletions
@@ -270,7 +270,26 @@ export const findLegacyEmperors = async (
`);
};
export const findLegacyEmperor = async (db: LegacyArchiveDatabase, id: number): Promise<LegacyEmperorRow | null> => {
export const findLegacyEmperorsByProfile = async (
db: LegacyArchiveDatabase,
sourceProfile: LegacyArchiveProfile
): Promise<LegacyEmperorRow[]> =>
db.$queryRaw<LegacyEmperorRow[]>(GamePrisma.sql`
SELECT
"id",
"source_profile" AS "sourceProfile",
"legacy_id" AS "legacyId",
"server_id" AS "serverId",
"data"
FROM "legacy_archive"."emperor"
WHERE "source_profile" = ${sourceProfile}
ORDER BY "id" DESC
`);
export const findLegacyEmperor = async (
db: LegacyArchiveDatabase,
input: { id: number; sourceProfile: LegacyArchiveProfile }
): Promise<LegacyEmperorRow | null> => {
const rows = await db.$queryRaw<LegacyEmperorRow[]>(GamePrisma.sql`
SELECT
"id",
@@ -279,7 +298,8 @@ export const findLegacyEmperor = async (db: LegacyArchiveDatabase, id: number):
"server_id" AS "serverId",
"data"
FROM "legacy_archive"."emperor"
WHERE "id" = ${id}
WHERE "id" = ${input.id}
AND "source_profile" = ${input.sourceProfile}
LIMIT 1
`);
return rows[0] ?? null;