fixed the issue in user address detail
This commit is contained in:
@@ -306,7 +306,7 @@ model Cities {
|
||||
id Int @id @default(autoincrement())
|
||||
stateXid Int @map("state_xid")
|
||||
states States @relation(fields: [stateXid], references: [id], onDelete: Cascade)
|
||||
cityName String @map("city_name") @db.VarChar(50)
|
||||
cityName String @unique @map("city_name") @db.VarChar(50)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -346,8 +346,8 @@ export class UserService {
|
||||
}
|
||||
|
||||
// 2️⃣ State: find or create (GLOBAL UNIQUE)
|
||||
let state = await tx.states.findUnique({
|
||||
where: { stateName },
|
||||
let state = await tx.states.findFirst({
|
||||
where: { stateName, countryXid: country.id },
|
||||
select: { id: true },
|
||||
});
|
||||
|
||||
@@ -362,8 +362,8 @@ export class UserService {
|
||||
}
|
||||
|
||||
// 3️⃣ City: find or create (GLOBAL UNIQUE)
|
||||
let city = await tx.cities.findUnique({
|
||||
where: { cityName },
|
||||
let city = await tx.cities.findFirst({
|
||||
where: { cityName, stateXid: state.id },
|
||||
select: { id: true },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user