Joellao
02/26/2019, 6:16 PMtype User {
id: ID! @unique
email: String @unique
username: String @unique
password: String!
firstname: String
lastname: String
createdAt: DateTime!
updatedAt: DateTime!
friends: [Friendship!]!
}
type Friendship{
id: ID! @unique
createdAt: DateTime!
users: [User!]!
}
and each user has an array of Friends. So I was thinking to implement it like the users of the people that array, but kinda went and using like the relation with Friendship table since i may want to know when they became friends etc, so the output of that is something like [idUser1, idUser2] and inside the user there is an array with the Ids of this record in Friendship table where the values are saved. Maybe this isn't the best way, in pure SQL i would have done something like the friendship table and saving user1 and user2 without the other fieldsCCBCodeMonkey
02/26/2019, 7:48 PMCCBCodeMonkey
02/26/2019, 7:48 PMCCBCodeMonkey
02/26/2019, 7:48 PMCCBCodeMonkey
02/26/2019, 7:49 PMCCBCodeMonkey
02/26/2019, 7:49 PMCCBCodeMonkey
02/26/2019, 7:50 PMCCBCodeMonkey
02/26/2019, 7:50 PMCCBCodeMonkey
02/26/2019, 7:51 PMCCBCodeMonkey
02/26/2019, 7:52 PMCCBCodeMonkey
02/26/2019, 7:53 PM