remove phone from user

This commit is contained in:
JakkrapartXD 2026-01-14 17:51:21 +07:00
parent fc76f086c7
commit 3ab76e7a43
3 changed files with 8 additions and 9 deletions

View file

@ -32,7 +32,6 @@ model User {
username String @unique @db.VarChar(50)
email String @unique @db.VarChar(255)
password String @db.VarChar(255)
phone String? @unique @db.VarChar(20)
role_id Int
email_verified_at DateTime?
created_at DateTime @default(now())

View file

@ -79,12 +79,12 @@ async function main() {
password: hashedPassword,
role_id: roles[0].id,
email_verified_at: new Date(),
phone: '0812345678',
profile: {
create: {
prefix: { th: 'นาย', en: 'Mr.' },
first_name: 'Admin',
last_name: 'User'
last_name: 'User',
phone: '0812345678'
}
}
}
@ -99,12 +99,12 @@ async function main() {
password: hashedPassword,
role_id: roles[1].id,
email_verified_at: new Date(),
phone: '0812345679',
profile: {
create: {
prefix: { th: 'นาย', en: 'Mr.' },
first_name: 'John',
last_name: 'Doe'
last_name: 'Doe',
phone: '0812345679'
}
}
}
@ -119,12 +119,12 @@ async function main() {
password: hashedPassword,
role_id: roles[2].id,
email_verified_at: new Date(),
phone: '0812345680',
profile: {
create: {
prefix: { th: 'นางสาว', en: 'Ms.' },
first_name: 'Jane',
last_name: 'Smith'
last_name: 'Smith',
phone: '0812345680'
}
}
}

View file

@ -81,8 +81,8 @@ export class AuthService {
throw new ValidationError('Email already exists');
}
// Check if phone number already exists
const existingPhone = await prisma.user.findUnique({
// Check if phone number already exists in user profiles
const existingPhone = await prisma.userProfile.findFirst({
where: { phone }
});