fix(migration): 검증 실패 아이콘을 명시적으로 제외한다
검토한 회원 번호의 이미지가 계속 유효성 조건을 어길 때만 업로드에서 제외한다. 기존 Ref 경로가 현재 선택인 경우 기본 아이콘으로 정리하고 최신 Core 선택은 보존한다.
This commit is contained in:
@@ -2,7 +2,7 @@ import { Pool } from 'pg';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { legacyUserId } from '../src/identity.js';
|
||||
import { syncImportedUserIcons, type PreparedLegacyUserIcon } from '../src/legacyUserIcons.js';
|
||||
import { syncImportedUserIcons, syncRejectedUserIcons, type PreparedLegacyUserIcon } from '../src/legacyUserIcons.js';
|
||||
|
||||
const databaseUrl = process.env.LEGACY_ICON_TEST_DATABASE_URL;
|
||||
|
||||
@@ -69,6 +69,37 @@ describe.skipIf(!databaseUrl)('legacy user icon PostgreSQL synchronization', ()
|
||||
);
|
||||
expect(library.rows).toHaveLength(3);
|
||||
expect(library.rows.filter((row) => row.retired_at !== null)).toHaveLength(1);
|
||||
|
||||
const rejectedUserId = legacyUserId(700_004);
|
||||
await client.query(
|
||||
`INSERT INTO "app_user"
|
||||
("id", "login_id", "display_name", "password_hash", "password_salt",
|
||||
"updated_at", "picture", "image_server")
|
||||
VALUES ($1, 'icon-test-rejected', '아이콘테스트-제외', 'hash', 'salt',
|
||||
CURRENT_TIMESTAMP, 'invalid.gif?=20260809', 1)`,
|
||||
[rejectedUserId]
|
||||
);
|
||||
await expect(
|
||||
syncRejectedUserIcons(
|
||||
client,
|
||||
[
|
||||
{
|
||||
memberNo: 700_004,
|
||||
userId: rejectedUserId,
|
||||
sourcePicture: 'invalid.gif?=20260809',
|
||||
normalizedSourcePicture: 'invalid.gif',
|
||||
sourceImageServer: 1,
|
||||
reason: 'not square',
|
||||
},
|
||||
],
|
||||
new Date('2026-08-24T00:00:00Z')
|
||||
)
|
||||
).resolves.toEqual({ currentReset: 1, targetPreserved: 0 });
|
||||
const rejectedAccount = await client.query<{ picture: string; image_server: number }>(
|
||||
`SELECT "picture", "image_server" FROM "app_user" WHERE "id" = $1`,
|
||||
[rejectedUserId]
|
||||
);
|
||||
expect(rejectedAccount.rows[0]).toEqual({ picture: 'default.jpg', image_server: 0 });
|
||||
} finally {
|
||||
await client.query('ROLLBACK');
|
||||
client.release();
|
||||
|
||||
Reference in New Issue
Block a user