You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modelPost {idInt@id@default(autoincrement())titleStringcategoriesCategoriesOnPosts[]}modelCategory {idInt@id@default(autoincrement())nameStringpostsCategoriesOnPosts[]}modelCategoriesOnPosts {postPost@relation(fields: [postId], references: [id])postIdInt// relation scalar field (used in the `@relation` attribute above)categoryCategory@relation(fields: [categoryId], references: [id])categoryIdInt// relation scalar field (used in the `@relation` attribute above)assignedAtDateTime@default(now())assignedByString@@id([postId, categoryId])}
post type
import{objectType}from'nexus'exportconstPost=objectType({nonNullDefaults: {output: true,input: false,},name: 'Post',definition(t){t.int('id')t.string('title')t.list.field('categories',{type: 'CategoriesOnPosts',// this is Category but it is CategoriesOnPostsargs: {where: 'CategoriesOnPostsWhereInput',orderBy:
'CategoriesOnPostsOrderByWithRelationAndSearchRelevanceInput',cursor: 'CategoriesOnPostsWhereUniqueInput',take: 'Int',skip: 'Int',distinct: 'CategoriesOnPostsScalarFieldEnum',},resolve(root: any){returnroot.categories},})},})
The text was updated successfully, but these errors were encountered:
doc: https://www.prisma.io/docs/concepts/components/prisma-schema/relations/many-to-many-relations
schema.prisma
post type
The text was updated successfully, but these errors were encountered: