update phone schema
This commit is contained in:
parent
1a7473362b
commit
646a10f45c
3 changed files with 40 additions and 27 deletions
|
|
@ -58,7 +58,7 @@ export class AuthService {
|
|||
* User registration
|
||||
*/
|
||||
async register(data: RegisterRequest): Promise<RegisterResponse> {
|
||||
const { username, email, password, first_name, last_name, prefix } = data;
|
||||
const { username, email, password, first_name, last_name, prefix, phone } = data;
|
||||
|
||||
// Check if username already exists
|
||||
const existingUsername = await prisma.user.findUnique({
|
||||
|
|
@ -78,6 +78,15 @@ export class AuthService {
|
|||
throw new ValidationError('Email already exists');
|
||||
}
|
||||
|
||||
// Check if phone number already exists
|
||||
const existingPhone = await prisma.user.findUnique({
|
||||
where: { phone }
|
||||
});
|
||||
|
||||
if (existingPhone) {
|
||||
throw new ValidationError('Phone number already exists');
|
||||
}
|
||||
|
||||
// Get STUDENT role
|
||||
const studentRole = await prisma.role.findUnique({
|
||||
where: { code: 'STUDENT' }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue