From 609c345739b2ca1379cbc2de240b819980d6d37a Mon Sep 17 00:00:00 2001 From: chyoo Date: Fri, 10 Jul 2026 10:55:04 +0900 Subject: [PATCH] link admin avatars by email-backed auth users --- src/admin-auth/admin-auth.service.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/admin-auth/admin-auth.service.ts b/src/admin-auth/admin-auth.service.ts index 012efb2..90f0e6b 100644 --- a/src/admin-auth/admin-auth.service.ts +++ b/src/admin-auth/admin-auth.service.ts @@ -254,13 +254,22 @@ export class AdminAuthService { throw new UnauthorizedException('관리자 세션이 유효하지 않습니다.'); } - const user = await this.authPrisma.user.findUnique({ + let user = await this.authPrisma.user.findUnique({ where: { email: admin.email }, select: { id: true }, }); if (!user) { - throw new NotFoundException('프로필 이미지와 연결할 사용자 계정을 찾을 수 없습니다.'); + user = await this.authPrisma.user.create({ + data: { + email: admin.email, + passwordHash: hashPassword(randomBytes(24).toString('hex')), + name: admin.name, + role: 'ADMIN', + isActive: true, + }, + select: { id: true }, + }); } return { admin, user };