-
Notifications
You must be signed in to change notification settings - Fork 0
/
chapter4-schema.graphql
189 lines (159 loc) · 2.87 KB
/
chapter4-schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
schema {
query: Query
mutation: Mutation
subscription: Subscription
}
type Subscription {
newPhoto(category: PhotoCategory): Photo!
newUser: User!
}
type Query {
totalPhotos: Int!
allPhotos(filter: PhotoFilter, paging: DataPage, sorting: DataSort): [Photo!]!
totalUsers: Int!
allUsers(paging: DataPage, sorting: DataSort): [User!]!
user(githubLogin: ID!): User!
photo(id: ID!): Photo!
agenda: [AgendaItem!]!
}
"""
postPhotoで送信される入力
"""
input PostPhotoInput {
"""
新しい写真の名前
"""
name: String!
"""
(optional)写真の簡単な説明
"""
description: String
"""
(optional)写真のカテゴリ
"""
category: PhotoCategory = PORTRAIT
}
input PhotoFilter {
category: PhotoCategory
createdBetween: DateRange
taggedUsers: [ID!]
searchText: String
}
input DateRange {
start: DateTime!
end: DateTime!
}
input DataPage {
first: Int = 25
start: Int = 0
}
input DataSort {
sort: SortDirection = DESCENDING
sortBy: SortablePhotoField = created
}
type AuthPayload {
user: User!
token: String!
}
type Mutation {
postPhoto("新しい写真の名前、説明、カテゴリ" input: PostPhotoInput!): Photo!
"""
GitHubユーザーで認可
"""
githubAuth(
"ユーザーの認可のために送信されるGitHubの一意のコード"
code: String!
): AuthPayload!
}
scalar DateTime
enum SortDirection {
ASCENDING
DESCENDING
}
enum SortablePhotoField {
name
description
category
created
}
enum PhotoCategory {
SELFIE
PORTRAIT
ACTION
LANDSCAPE
GRAPHIC
}
type Photo {
id: ID!
name: String!
url: String!
description: String
created: DateTime!
category: PhotoCategory!
postedBy: User!
taggedUsers(sorting: DataSort): [User!]!
}
"""
最低一度はGitHubで認可されたユーザー
"""
type User {
"""
ユーザーの一位のGitHubログインID
"""
githubLogin: ID!
"""
ユーザーの姓名
"""
name: String
"""
ユーザーのGitHubのプロフィール画像のURL
"""
avatar: String
"""
このユーザーが投稿した全写真
"""
postedPhotos(
filter: PhotoFilter
paging: DataPage
sorting: DataSort
): [Photo!]!
"""
このユーザーが含まれる全写真
"""
inPhotos: [Photo!]!
friends: [Friendship!]!
}
scalar Location
type Friendship {
friends: [User!]!
howLong: Int!
whereWeMet: Location
}
# union AgendaItem = StudyGroup | Workout
# type StudyGroup {
# name: String!
# subject: String!
# students: [User!]!
# }
# type Workout {
# name: String!
# reps: Int!
# }
interface AgendaItem {
name: String!
start: DateTime!
end: DateTime!
}
type StudyGroup implements AgendaItem {
name: String!
start: DateTime!
end: DateTime!
participants: [User!]!
topic: String!
}
type Workout implements AgendaItem {
name: String!
start: DateTime!
end: DateTime!
reps: Int!
}