Running an e2e test on my nest API using Prisma to manage the database connections I got the following error on terminal:
PrismaClientValidationError:
Invalid `this.prisma.user.update()` invocation in
/Users/daniel/DocumentosMac/backend/nestjs-api-tutorial/src/user/user.service.ts:9:41
6 export class UserService {
7 constructor(private prisma: PrismaService) {}
8 async editUser(userId: number, dto: EditUserDto) {
→ 9 const user = await this.prisma.user.update({
where: {
id: {
id: 19,
createdAt: new Date("2024-03-05T11:20:28.678Z"),
updatedAt: new Date("2024-03-05T11:20:28.678Z"),
email: "[email protected]",
firstName: null,
lastName: null
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
},
data: {
firstName: "Daniel",
email: "[email protected]"
}
})
Argument `id`: Invalid value provided. Expected Int, provided Object......
I think the issue is on id 19 times, but no Idea on what to do next. If you curious about the rest of the code in test file and user.service.ts is here: https://pastebin.com/3WsN7uv9
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.