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 };