Bổ sung số đt và địa chỉ vào phần đăng ký tài khoản
This commit is contained in:
Vendored
+3
-3
@@ -66,7 +66,7 @@ let AuthController = class AuthController {
|
||||
};
|
||||
}
|
||||
async signup(body) {
|
||||
const { email, password, name } = body;
|
||||
const { email, password, name, phone, address } = body;
|
||||
const existingUser = await this.prisma.user.findUnique({ where: { email } });
|
||||
if (existingUser)
|
||||
throw new BadRequestException('Email đã được sử dụng');
|
||||
@@ -74,8 +74,8 @@ let AuthController = class AuthController {
|
||||
const shouldBeAdmin = userCount === 0;
|
||||
const passwordHash = await bcrypt.hash(password, 10);
|
||||
return this.prisma.user.create({
|
||||
data: { email, passwordHash, name, isAdmin: shouldBeAdmin },
|
||||
select: { id: true, email: true, name: true, isAdmin: true }
|
||||
data: { email, passwordHash, name, phone, address, isAdmin: shouldBeAdmin },
|
||||
select: { id: true, email: true, name: true, phone: true, address: true, isAdmin: true }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user