-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.graphqls
192 lines (166 loc) · 5.42 KB
/
schema.graphqls
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
190
191
192
scalar DateTime
scalar UUID
# Course of the application
type Course {
# UUID of the course
id: UUID!
# Title of the course, max 255 characters
title: String!
# Description of the course, max 3000 characters
description: String!
# Start date of the course, ISO 8601 format
startDate: DateTime!
# End date of the course, ISO 8601 format
endDate: DateTime!
# Published status of the course
published: Boolean!
# Chapters of the course
chapters: [Chapter!]!
}
input CreateCourseInput {
# Title of the course, max 255 characters
title: String! @NotBlank @Size(max: 255)
# Description of the course, max 3000 characters
description: String! @Size(max: 3000)
# Start date of the course, ISO 8601 format
startDate: DateTime!
# End date of the course, ISO 8601 format
endDate: DateTime!
# Published status of the course
published: Boolean!
}
input UpdateCourseInput {
# UUID of the course
id: UUID!
# Title of the course, max 255 characters
title: String! @NotBlank @Size(max: 255)
# Description of the course, max 3000 characters
description: String! @Size(max: 3000)
# Start date of the course, ISO 8601 format
startDate: DateTime!
# End date of the course, ISO 8601 format
endDate: DateTime!
# Published status of the course
published: Boolean!
}
# Chapter of a course
type Chapter {
# UUID of the chapter
id: UUID!
# Title of the chapter, max 255 characters
title: String!
# Description of the chapter, max 3000 characters
description: String!
# Number of the chapter, determines the order of the chapters
number: Int!
# Start date of the chapter, ISO 8601 format
startDate: DateTime!
# End date of the chapter, ISO 8601 format
endDate: DateTime!
# The course the chapter belongs to
course: Course!
}
input CreateChapterInput {
# Title of the chapter, max 255 characters
title: String! @NotBlank @Size(max: 255)
# Description of the chapter, max 3000 characters
description: String! @Size(max: 3000)
# Number of the chapter, determines the order of the chapters
number: Int! @Positive
# Start date of the chapter, ISO 8601 format
startDate: DateTime!
# End date of the chapter, ISO 8601 format
endDate: DateTime!
# The course the chapter belongs to
courseId: UUID!
}
input UpdateChapterInput {
id: UUID!
# Title of the chapter, max 255 characters
title: String! @NotBlank @Size(max: 255)
# Description of the chapter, max 3000 characters
description: String! @Size(max: 3000)
# Number of the chapter, determines the order of the chapters
number: Int! @Positive
# Start date of the chapter, ISO 8601 format
startDate: DateTime!
# End date of the chapter, ISO 8601 format
endDate: DateTime!
}
type User {
id: UUID!
username: String!
email: String!
firstName: String!
lastName: String!
coursesJoined: [Course!]!
coursesOwned: [Course!]!
# role?
}
interface Content {
id: UUID!
name: String!
rewardPoints: Int!
workedOn: Boolean!
}
type MediaContent implements Content {
id: UUID!
name: String!
rewardPoints: Int!
workedOn: Boolean!
media: MediaRecord!
}
type MediaRecord {
id: UUID!
name: String!
type: MediaType!
}
input CreateMediaRecordInput {
name: String!
type: MediaType!
}
input UpdateMediaRecordInput {
id: UUID!
name: String!
type: MediaType!
}
enum MediaType {
VIDEO
AUDIO
IMAGE
PRESENTATION
DOCUMENT
URL
}
type SkillLevel {
# TODO add assessments
id: UUID!
}
type Query {
currentUser: User!
courses: [Course!]! # TODO pagination and filters
coursesById(ids: [UUID!]!): [Course!]!
mediaRecordsById(ids: [UUID!]!): [MediaRecord!]!
mediaRecords: [MediaRecord!]!
}
type Mutation {
createCourse(input: CreateCourseInput!): Course!
updateCourse(input: UpdateCourseInput!): Course!
# deletes course, throws error when no course with the id exists
deleteCourse(id: UUID!): UUID!
createChapter(input: CreateChapterInput!): Chapter!
updateChapter(input: UpdateChapterInput!): Chapter!
# deletes chapter, throws error when no chapter with the id exists
deleteChapter(id: UUID!): UUID!
createMediaRecord(input: CreateMediaRecordInput!): MediaRecord!
updateMediaRecord(input: UpdateMediaRecordInput!): MediaRecord!
# deletes media record, throws error when no media record with the id exists
deleteMediaRecord(id: UUID!): UUID!
}
# see also https://github.com/graphql-java/graphql-java-extended-validation/blob/master/README.md
directive @Max(value : Int! = 2147483647, message : String = "graphql.validation.Max.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @Min(value : Int! = 0, message : String = "graphql.validation.Min.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @NotBlank(message : String = "graphql.validation.NotBlank.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @NotEmpty(message : String = "graphql.validation.NotEmpty.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @Positive(message : String = "graphql.validation.Positive.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
directive @Size(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Size.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION