nobyf
05/25/2019, 6:38 AMtype User {
id: ID! @unique
username: String! @unique
likes: [Item!]!
follows: [User!]!
followers: [User!]!
categories: [Category!]! @relation(name: "CategoryToUser", onDelete: CASCADE)
items: [Item!]! @relation(name: "ItemToUser", onDelete: CASCADE)
comments: [Comment!]! @relation(name: "CommentToUser", onDelete: CASCADE)
...
}
What is the best way to set up relations for likes, follows, followers as the items do not usually belong to the user him/herself?
or better to do like below? (just keep user or item ids).
likes: [ID!]!
follows: [ID!]!
followers: [ID!]!
and add some logic in the node server?Sachin Jani
05/25/2019, 7:36 AMtype Item {
id: ID! @unique
likes: [User!]
}
nobyf
05/25/2019, 4:16 PMnobyf
05/25/2019, 4:16 PMtype Item {
id: ID! @unique
title: String!
tags: [String!]!
liked: [User!]!
...
}
nobyf
05/25/2019, 4:19 PMtafelito
05/25/2019, 5:55 PMtafelito
05/25/2019, 5:55 PMconst [group] = await prisma.rulesGroups({
where: { rules_some: { id: parent.id } },
});