Given a user id
, I want to find the followers that the user follows (i.e. follow each other)
My Prisma model looks like the following:
model User {
id Int @id @default(autoincrement())
name String?
followedBy Follows[] @relation("following")
following Follows[] @relation("follower")
}
model Follows {
follower User @relation("follower", fields: [followerId], references: [id])
followerId Int
following User @relation("following", fields: [followingId], references: [id])
followingId Int
@@id([followerId, followingId])
}
I am also interested in counting them - this could be done in a separate query since the former might require pagination at some point.
Thank you in advance for your help.