Nichita Z
06/22/2021, 2:23 PMthis.prisma.user.findUnique({where: {id: 1}, include: {_count: true}})
Ryan
06/22/2021, 2:24 PMschema.prisma
and then run prisma generate
?Nichita Z
06/22/2021, 2:24 PMRyan
06/22/2021, 2:25 PMNichita Z
06/22/2021, 2:26 PMpendingFollowers PendingFollowers[] @relation(name: "targets")
pendingFollowing PendingFollowers[] @relation(name: "sources")
So these are both in the user object, and they relate to a model that looks like this:
model PendingFollowers {
source User @relation(name: "sources", fields: [sourceId], references: [id])
sourceId Int
target User @relation(name: "targets", fields: [targetId], references: [id])
targetId Int
createdAt DateTime @default(now())
@@id([sourceId, targetId])
}
Nichita Z
06/22/2021, 2:27 PMRyan
06/22/2021, 2:30 PMNichita Z
06/22/2021, 2:30 PMNichita Z
06/22/2021, 2:30 PMRyan
06/22/2021, 2:31 PMNichita Z
06/22/2021, 2:32 PMNichita Z
06/22/2021, 2:33 PMfollowers User[] @relation(name: "approved-followers")
following User[] @relation(name: "approved-followers")
These are in the user model, does it seem OK to you? The examples in the docs are for relations between different objects, but I thought this would workRyan
06/22/2021, 2:33 PMNichita Z
06/22/2021, 2:38 PM