remove phone from user
This commit is contained in:
parent
fc76f086c7
commit
3ab76e7a43
3 changed files with 8 additions and 9 deletions
|
|
@ -32,7 +32,6 @@ model User {
|
||||||
username String @unique @db.VarChar(50)
|
username String @unique @db.VarChar(50)
|
||||||
email String @unique @db.VarChar(255)
|
email String @unique @db.VarChar(255)
|
||||||
password String @db.VarChar(255)
|
password String @db.VarChar(255)
|
||||||
phone String? @unique @db.VarChar(20)
|
|
||||||
role_id Int
|
role_id Int
|
||||||
email_verified_at DateTime?
|
email_verified_at DateTime?
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,12 @@ async function main() {
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
role_id: roles[0].id,
|
role_id: roles[0].id,
|
||||||
email_verified_at: new Date(),
|
email_verified_at: new Date(),
|
||||||
phone: '0812345678',
|
|
||||||
profile: {
|
profile: {
|
||||||
create: {
|
create: {
|
||||||
prefix: { th: 'นาย', en: 'Mr.' },
|
prefix: { th: 'นาย', en: 'Mr.' },
|
||||||
first_name: 'Admin',
|
first_name: 'Admin',
|
||||||
last_name: 'User'
|
last_name: 'User',
|
||||||
|
phone: '0812345678'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -99,12 +99,12 @@ async function main() {
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
role_id: roles[1].id,
|
role_id: roles[1].id,
|
||||||
email_verified_at: new Date(),
|
email_verified_at: new Date(),
|
||||||
phone: '0812345679',
|
|
||||||
profile: {
|
profile: {
|
||||||
create: {
|
create: {
|
||||||
prefix: { th: 'นาย', en: 'Mr.' },
|
prefix: { th: 'นาย', en: 'Mr.' },
|
||||||
first_name: 'John',
|
first_name: 'John',
|
||||||
last_name: 'Doe'
|
last_name: 'Doe',
|
||||||
|
phone: '0812345679'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,12 +119,12 @@ async function main() {
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
role_id: roles[2].id,
|
role_id: roles[2].id,
|
||||||
email_verified_at: new Date(),
|
email_verified_at: new Date(),
|
||||||
phone: '0812345680',
|
|
||||||
profile: {
|
profile: {
|
||||||
create: {
|
create: {
|
||||||
prefix: { th: 'นางสาว', en: 'Ms.' },
|
prefix: { th: 'นางสาว', en: 'Ms.' },
|
||||||
first_name: 'Jane',
|
first_name: 'Jane',
|
||||||
last_name: 'Smith'
|
last_name: 'Smith',
|
||||||
|
phone: '0812345680'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@ export class AuthService {
|
||||||
throw new ValidationError('Email already exists');
|
throw new ValidationError('Email already exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if phone number already exists
|
// Check if phone number already exists in user profiles
|
||||||
const existingPhone = await prisma.user.findUnique({
|
const existingPhone = await prisma.userProfile.findFirst({
|
||||||
where: { phone }
|
where: { phone }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue