schema.prisma file I need help how can I update a post based on 2 conditions? The user id that I get from userId which belongs to user tab and post id which belongs to on other post table
updatePost: async (parant, args, context) => {
const { userId } = context;
const postExist = await context.prisma.post.findUnique({
where: {
id: args.id,
author:{
id: userId
}
}
})
if (!postExist) {
throw new Error ('post not found')
}
const updatedPost = await context.prisma.post.update({
data:{
...args.data
}
})
return updatedPost
},
error code:
"message": "\nInvalid `context.prisma.post.findUnique()` invocation
Argument where of type PostWhereUniqueInput needs exactly one argument, but you provided id and author. Please choose one. Available args: ",
"type PostWhereUniqueInput {",
" id?: Int",
"Unknown arg `author` in where.author for type PostWhereUniqueInput. Available args:",
"",
"type PostWhereUniqueInput {",
" id?: Int",
"}",