-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.gql
More file actions
123 lines (105 loc) · 2.41 KB
/
schema.gql
File metadata and controls
123 lines (105 loc) · 2.41 KB
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
schema {
query: Query
mutation: Mutation
}
"""
Integers that will have a value of 0 or more.
"""
scalar NonNegativeInt
"""
A string that cannot be passed as an empty value
"""
scalar NonEmptyString
"""
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
"""
scalar DateTime
"""
A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/.
"""
scalar EmailAddress @specifiedBy(url: "https://www.w3.org/Protocols/rfc822/")
type User {
email: String!
"Posts created by user"
posts(input: CursorConnectionArgs!): PostsConnection!
id: ID!
name: String
role: UserRole!
}
input LoginInput {
email: EmailAddress!
}
input RegisterInput {
email: EmailAddress!
}
type AuthResult {
user: User
error: String
token: String
}
type Query {
"Current authenticated user"
currentUser: AuthResult!
"Get all published posts"
publicPosts(input: CursorConnectionArgs!): PostsConnection!
"Get all current created categories"
postsCategories: [Category!]!
hello: String!
namesList(n: Int = 10): [String!]!
}
type Mutation {
"Login user"
login(input: LoginInput!): AuthResult!
"Register user"
register(input: RegisterInput!): AuthResult!
"[Authenticated] Create new post"
createPost(post: PostCreate!): Post!
"[Authenticated] Update existing post"
updatePost(post: PostUpdate!): Post!
"[Authenticated] Remove own post"
removeOwnPost(postId: String!): Boolean!
setName(name: String!): User!
hello: String!
}
type Category {
id: ID!
name: String
posts(input: CursorConnectionArgs!): PostsConnection!
}
type Post {
id: ID!
createdAt: DateTime!
published: Boolean!
title: String!
category: [Category!]
}
input PostCreate {
title: NonEmptyString!
category: [String!]
}
input PostUpdate {
id: String!
title: NonEmptyString
category: [String!]
published: Boolean
}
type PostsConnection {
nodes: [Post!]!
pageInfo: CursorPageInfo!
}
enum UserRole {
USER
ADMIN
}
input CursorConnectionArgs {
first: NonNegativeInt
after: NonEmptyString
last: NonNegativeInt
before: NonEmptyString
}
type CursorPageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: NonEmptyString
endCursor: NonEmptyString
}