Bård
06/29/2021, 9:46 AMprisma.practitioneer.update({
where: {
userID,
},
data: {
image: {
update: {
where: { id: imageID },
data: {
image: image.data,
type: image.type,
},
},
},
},
});
But I’m getting this error:
Unknown arg `image` in data.image for type practitioneerUncheckedUpdateInput. Did you mean `imageID`? Available args: …
If I try to change the query to (which is obviously wrong):
prisma.practitioneer.update({
where: {
userID,
},
data: {
imageID: {
update: {
where: { id: imageID },
data: {
image: image.data,
type: image.type,
},
},
},
},
});
I get the same error, only now it’s suggesting the correct field, the one it previously said it didn’t find:
Unknown arg `imageID` in data.image for type practitioneerUncheckedUpdateInput. Did you mean `image`? Available args: …
Ryan
06/29/2021, 9:57 AMBård
06/29/2021, 9:58 AMmodel practitioneer {
id Int @id @default(autoincrement())
key String @unique @default(uuid()) @db.Char(36)
userID String @map(name: "user_id") @unique
name String @db.VarChar(250)
firstName String @db.VarChar(250)
surname String @db.VarChar(250)
birth String @default("") @db.VarChar(250)
sex String @default("") @db.VarChar(250)
email String @db.VarChar(50)
phone String @db.VarChar(14)
address String @default("") @db.VarChar(250)
postal String @db.VarChar(20)
postalLocation String @db.VarChar(100)
imageID Int
stateID Int
locationID Int
professionKey String @default("") @db.VarChar(20)
experience Int
description String @default("") @db.VarChar(1000)
clinicID Int?
externalID Int?
image image @relation(fields: [imageID], references: [id])
user User? @relation(fields: [userID], references: [id])
clinic clinic? @relation(fields: [clinicID], references: [id])
location location @relation(fields: [locationID], references: [id])
profession profession @relation(fields: [professionKey], references: [key])
state state @relation(fields: [stateID], references: [id])
activity activity[]
features features[]
products products[]
specialities specialities[]
@@index([clinicID], name: "idx_16432_clinicID")
@@index([locationID], name: "idx_16432_location")
@@index([professionKey], name: "idx_16432_profession")
@@index([stateID], name: "idx_16432_state")
}
Bård
06/29/2021, 9:59 AMmodel image {
id Int @id @default(autoincrement())
image Bytes
type String
practitioneer practitioneer[]
}
Ryan
06/29/2021, 10:12 AMdata
and where
. Just pass whatever you would want to update directly under image: { update: { …data } }
.Bård
06/29/2021, 10:13 AMRyan
06/29/2021, 10:14 AMBård
06/30/2021, 8:39 AMBård
06/30/2021, 11:02 AMBård
06/30/2021, 11:02 AMawait prisma.practitioneer.update({
where: {
userID: req.userToken.uid,
},
data: {
clinic: {
delete: {},
},
},
});
Bård
06/30/2021, 11:03 AMclinic clinic? @relation(fields: [clinicID], references: [id])
Bård
06/30/2021, 11:03 AM[0] Unknown arg `clinic` in data.clinic for type practitioneerUncheckedUpdateInput. Did you mean `clinicID`? Available args:
Ryan
06/30/2021, 11:12 AMBård
06/30/2021, 11:12 AMRyan
06/30/2021, 11:22 AMawait prisma.practitioneer.update({
where: {
userID: 'req.userToken.uid',
},
data: {
clinic: {
delete: true,
},
},
})
delete
only needs a boolean as it’s just a single relationBård
06/30/2021, 11:49 AMBård
06/30/2021, 11:50 AMRyan
06/30/2021, 11:51 AMBård
06/30/2021, 11:52 AMBård
06/30/2021, 11:53 AMBård
06/30/2021, 11:53 AMRyan
06/30/2021, 12:08 PMBård
06/30/2021, 12:09 PMBård
06/30/2021, 12:10 PMBård
06/30/2021, 12:10 PMRyan
06/30/2021, 12:10 PM