Zach Hobbs
12/04/2017, 7:35 PM{
allVideos {
...video
watchedStatus(user: $user) {
isWatched
}
}}Dukuo
12/04/2017, 7:36 PMDukuo
12/04/2017, 7:36 PMDukuo
12/04/2017, 7:36 PMUser case I would use what @panzupa said, and store the Video ID in a custom User field such as watchedVideosDukuo
12/04/2017, 7:38 PMUser schema you would have a watchedVideos field of type [Video!] with a relationName in betweenDukuo
12/04/2017, 7:38 PMUser {
ID: ID!
[....]
watchedVideos: [Video!] @relationName(name:"UserWatchedVideos")
}Zach Hobbs
12/04/2017, 7:39 PMvideos?Dukuo
12/04/2017, 7:40 PMquery getUserWatchedVideos($user_id:ID!) {
getUser(id:$user_id) {
watchedVideos: {
id
url
[....]
}
}
}Dukuo
12/04/2017, 7:40 PMpanzupa
12/04/2017, 7:40 PMDukuo
12/04/2017, 7:40 PMpanzupa
12/04/2017, 7:41 PMpanzupa
12/04/2017, 7:41 PMDukuo
12/04/2017, 7:42 PMquery getUserWatchedVideos($user_id:ID!) {
getUser(id:$user_id) {
watchedVideos(
filter: {
category_in: ["Comedy"]
}) {
id
url
[....]
}
}
}Zach Hobbs
12/04/2017, 7:43 PMDukuo
12/04/2017, 7:44 PMcategory field)Dukuo
12/04/2017, 7:44 PMcategory field, but the example I typed is assuming you have a category field in your Video type with hardcoded category namesZach Hobbs
12/04/2017, 7:44 PMDukuo
12/04/2017, 7:45 PMCategory Type referenced within your Video TypeDukuo
12/04/2017, 7:45 PMtrond
12/04/2017, 7:45 PMtrond
12/04/2017, 7:45 PMDukuo
12/04/2017, 7:46 PMZach Hobbs
12/04/2017, 7:47 PMDukuo
12/04/2017, 7:48 PMUser.watchedVideosDukuo
12/04/2017, 7:48 PMtrond
12/04/2017, 7:49 PMZach Hobbs
12/04/2017, 7:50 PMDukuo
12/04/2017, 7:51 PMAction type would be like a history for User's actions, right @trond? like if the user watches a video, you would store an Action with a action field equals to 'video', an ID of the Video and ID of a User, right ?trond
12/04/2017, 7:51 PMDukuo
12/04/2017, 7:51 PMDukuo
12/04/2017, 7:51 PMtrond
12/04/2017, 7:52 PMZach Hobbs
12/04/2017, 7:54 PMtrond
12/04/2017, 7:58 PMDukuo
12/04/2017, 7:58 PMDukuo
12/04/2017, 7:59 PMtrond
12/04/2017, 7:59 PMDukuo
12/04/2017, 7:59 PMDukuo
12/04/2017, 8:00 PMZach Hobbs
12/04/2017, 8:00 PMtrond
12/04/2017, 8:01 PMpanzupa
12/04/2017, 8:01 PMZach Hobbs
12/04/2017, 8:02 PMDukuo
12/04/2017, 8:03 PMDukuo
12/04/2017, 8:03 PMpanzupa
12/04/2017, 8:03 PMZach Hobbs
12/04/2017, 8:03 PMDukuo
12/04/2017, 8:03 PMtrond
12/04/2017, 8:03 PMtrond
12/04/2017, 8:04 PMpanzupa
12/04/2017, 8:04 PMDukuo
12/04/2017, 8:05 PMDukuo
12/04/2017, 8:05 PMZach Hobbs
12/04/2017, 8:05 PMwatched for each video in the response...basically decorating the graph.cool resultsZach Hobbs
12/04/2017, 8:06 PMZach Hobbs
12/04/2017, 8:06 PMDukuo
12/04/2017, 8:06 PMDukuo
12/04/2017, 8:06 PMwatched field is in a User oriented way everything will be fineDukuo
12/04/2017, 8:07 PMVideo oriented you wouldn't be able to have a granular access to each user's preferencepanzupa
12/04/2017, 8:07 PMAction can have security adavantagepanzupa
12/04/2017, 8:08 PMAction type is less serious than on User type, however in GC permission queries are quite fine grained (single field level)Dukuo
12/04/2017, 8:09 PMpanzupa
12/04/2017, 8:09 PMDukuo
12/04/2017, 8:09 PMAction type as wellpanzupa
12/04/2017, 8:10 PMAction type?panzupa
12/04/2017, 8:11 PMuser ID! and `interface ID! - does GC supports interfaces? I haven't used them if it does...Dukuo
12/04/2017, 8:11 PMaction field which could be with a value of `video`for this example, a Video ID and a User IDDukuo
12/04/2017, 8:11 PMDukuo
12/04/2017, 8:11 PMDukuo
12/04/2017, 8:12 PMDukuo
12/04/2017, 8:12 PMpanzupa
12/04/2017, 8:13 PMpanzupa
12/04/2017, 8:13 PMtrond
12/04/2017, 8:17 PMDukuo
12/04/2017, 8:17 PMAction typeDukuo
12/04/2017, 8:17 PMDukuo
12/04/2017, 8:18 PMDukuo
12/04/2017, 8:18 PMfield for each Type you would want in an AccessGroupDukuo
12/04/2017, 8:19 PMpanzupa
12/04/2017, 8:19 PMDukuo
12/04/2017, 8:22 PM