This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user