See Jee
08/25/2021, 8:40 AMconst found = await this.prisma.post.findFirst({
where: {
postUid,
},
});
Error
Invalid `prisma.post.findFirst()` invocation:
{
where: {
postUid: {
postUid: '4d69bcaa-f3b8-4cb9-a3f7-bf164a8bae99'
~~~~~~~~~~~
}
}
}
Unknown arg `postUid` in where.postUid.postUid for type StringFilter. Available args:
Ryan
08/25/2021, 9:29 AMSee Jee
08/25/2021, 9:32 AMmodel Post {
postUid String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid
title String
description String?
categories CategoryPost[]
}
model Category {
id Int @id @default(autoincrement())
title String
posts CategoryPost[]
}
model CategoryPost {
id Int @default(autoincrement())
post Post @relation(fields: [postUid], references: [postUid])
category Category @relation(fields: [categoryId], references: [id])
postUid String @db.Uuid
categoryId Int
@@id([postUid, categoryId])
}
Ryan
08/25/2021, 9:35 AMpostUid
directly. Not postUid
inside postUid
again.See Jee
08/25/2021, 9:40 AM@Body() _postUid_: string
but if I use it in query it become postUid: { postUid: postUid }
in query and I still dont get it why it become like that 🙂See Jee
08/25/2021, 9:41 AMRyan
08/25/2021, 9:50 AMpostUid
is an object here. I am not aware of DTO but the body in any request would always be an object so maybe the @Body() body
will always be an object and not directly a string. Are you passing an object to the API?See Jee
08/25/2021, 9:52 AM{
"postUid": "4d69bcaa-f3b8-4cb9-a3f7-bf164a8bae99"
}
Ryan
08/25/2021, 9:59 AMSee Jee
08/25/2021, 10:29 AM