From 08a0ceee61ea6440d4d010d62b9f5f42fdb16591 Mon Sep 17 00:00:00 2001 From: minij02 Date: Mon, 27 Jul 2026 00:08:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20admin=20=ED=9A=8C=EC=9B=90=20=ED=86=B5?= =?UTF-8?q?=EA=B3=84=20social=5Ftype=20=EB=8C=80=EC=86=8C=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20=EC=A0=95=EA=B7=9C=ED=99=94=20(#521)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 매핑 lookup 을 toUpperCase() 로 case-insensitive 처리 - 레거시 소문자 social_type 을 대문자로 일괄 백필하는 마이그레이션 추가 --- .../migration.sql | 6 ++++++ src/stats/services/admin-stats.service.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20260727120000_normalize_user_social_type_uppercase/migration.sql diff --git a/prisma/migrations/20260727120000_normalize_user_social_type_uppercase/migration.sql b/prisma/migrations/20260727120000_normalize_user_social_type_uppercase/migration.sql new file mode 100644 index 0000000..d2adae0 --- /dev/null +++ b/prisma/migrations/20260727120000_normalize_user_social_type_uppercase/migration.sql @@ -0,0 +1,6 @@ +-- Backfill: legacy rows had lowercase social_type ('google', 'naver', 'kakao'). +-- Current write paths (config/social/*.ts, auth.service.ts) always store uppercase, +-- so this one-shot normalization aligns historical data with the code contract. +UPDATE `User` +SET `social_type` = UPPER(`social_type`) +WHERE `social_type` IN ('google', 'naver', 'kakao'); diff --git a/src/stats/services/admin-stats.service.ts b/src/stats/services/admin-stats.service.ts index a7cff50..a480b3b 100644 --- a/src/stats/services/admin-stats.service.ts +++ b/src/stats/services/admin-stats.service.ts @@ -29,7 +29,7 @@ export const getMemberStats = async (): Promise => { let total = 0; for (const row of grouped) { - const channel = SOCIAL_TYPE_TO_CHANNEL[row.social_type]; + const channel = SOCIAL_TYPE_TO_CHANNEL[row.social_type?.toUpperCase()]; if (!channel) continue; byChannel[channel].count = row._count._all; total += row._count._all;