sagar lama
02/18/2022, 7:18 AMmodel Post {
id Int @id @default(autoincrement())
title String
categories CategoriesOnPosts[]
}
model Category {
id Int @id @default(autoincrement())
name String
posts CategoriesOnPosts[]
}
model CategoriesOnPosts {
post Post @relation(fields: [postId], references: [id])
postId Int
category Category @relation(fields: [categoryId], references: [id])
categoryId Int
assignedAt DateTime @default(now())
assignedBy String
@@id([postId, categoryId])
}
Typescript is giving me an error when I try the following,
jest.spyOn(<http://prisma.post|prisma.post>, 'findFirst').mockResolvedValue({
...mockPost,
categories: [...mockCategories],
});