Bổ sung số đt và địa chỉ vào phần đăng ký tài khoản

This commit is contained in:
2026-06-14 16:10:30 +07:00
parent 3a29f98c96
commit c6d0fdd5d1
10 changed files with 60 additions and 20 deletions
+3 -3
View File
@@ -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 }
});
}
};