Skip to content

Commit dddd4da

Browse files
committed
Merge branch 'aws-migration' of https://github.com/codeforjapan/StudyAtHome into aws-migration
2 parents ce967f3 + 97a191c commit dddd4da

File tree

4 files changed

+218
-18
lines changed

4 files changed

+218
-18
lines changed

amplify/backend/api/studyathome/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Material
3636

3737
type Lesson
3838
@model
39-
@key(name: "byClass", fields: ["classId", "startTime"])
39+
@key(name: "byClass", fields: ["classId", "startTime"], queryField: "listLessonsByClass")
4040
@auth(
4141
rules: [
4242
{ allow: public, operations: [read], provider: apiKey }

src/API.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,22 @@ export type ModelLessonFilterInput = {
183183
not?: ModelLessonFilterInput | null,
184184
};
185185

186+
export type ModelStringKeyConditionInput = {
187+
eq?: string | null,
188+
le?: string | null,
189+
lt?: string | null,
190+
ge?: string | null,
191+
gt?: string | null,
192+
between?: Array< string | null > | null,
193+
beginsWith?: string | null,
194+
};
195+
196+
export enum ModelSortDirection {
197+
ASC = "ASC",
198+
DESC = "DESC",
199+
}
200+
201+
186202
export type CreateClassMutationVariables = {
187203
input: CreateClassInput,
188204
condition?: ModelClassConditionInput | null,
@@ -791,6 +807,66 @@ export type ListLessonsQuery = {
791807
} | null,
792808
};
793809

810+
export type ListLessonsByClassQueryVariables = {
811+
classId?: string | null,
812+
startTime?: ModelStringKeyConditionInput | null,
813+
sortDirection?: ModelSortDirection | null,
814+
filter?: ModelLessonFilterInput | null,
815+
limit?: number | null,
816+
nextToken?: string | null,
817+
};
818+
819+
export type ListLessonsByClassQuery = {
820+
listLessonsByClass: {
821+
__typename: "ModelLessonConnection",
822+
items: Array< {
823+
__typename: "Lesson",
824+
id: string,
825+
classId: string,
826+
startTime: string,
827+
endTime: string,
828+
title: string,
829+
subject: {
830+
__typename: "Subject",
831+
name: string,
832+
color: string,
833+
},
834+
goal: string | null,
835+
description: string | null,
836+
videos: Array< {
837+
__typename: "Video",
838+
title: string | null,
839+
url: string,
840+
thumbnailUrl: string | null,
841+
} > | null,
842+
pages: string | null,
843+
materials: Array< {
844+
__typename: "Material",
845+
title: string | null,
846+
url: string,
847+
} > | null,
848+
isHidden: boolean,
849+
owner: string,
850+
createdAt: string,
851+
updatedAt: string,
852+
class: {
853+
__typename: "Class",
854+
id: string,
855+
className: string,
856+
schoolName: string,
857+
owner: string,
858+
createdAt: string,
859+
updatedAt: string,
860+
lessons: {
861+
__typename: "ModelLessonConnection",
862+
nextToken: string | null,
863+
} | null,
864+
},
865+
} | null > | null,
866+
nextToken: string | null,
867+
} | null,
868+
};
869+
794870
export type OnCreateClassSubscription = {
795871
onCreateClass: {
796872
__typename: "Class",

src/graphql/queries.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,62 @@ export const listLessons = /* GraphQL */ `
193193
}
194194
}
195195
`;
196+
export const listLessonsByClass = /* GraphQL */ `
197+
query ListLessonsByClass(
198+
$classId: ID
199+
$startTime: ModelStringKeyConditionInput
200+
$sortDirection: ModelSortDirection
201+
$filter: ModelLessonFilterInput
202+
$limit: Int
203+
$nextToken: String
204+
) {
205+
listLessonsByClass(
206+
classId: $classId
207+
startTime: $startTime
208+
sortDirection: $sortDirection
209+
filter: $filter
210+
limit: $limit
211+
nextToken: $nextToken
212+
) {
213+
items {
214+
id
215+
classId
216+
startTime
217+
endTime
218+
title
219+
subject {
220+
name
221+
color
222+
}
223+
goal
224+
description
225+
videos {
226+
title
227+
url
228+
thumbnailUrl
229+
}
230+
pages
231+
materials {
232+
title
233+
url
234+
}
235+
isHidden
236+
owner
237+
createdAt
238+
updatedAt
239+
class {
240+
id
241+
className
242+
schoolName
243+
owner
244+
createdAt
245+
updatedAt
246+
lessons {
247+
nextToken
248+
}
249+
}
250+
}
251+
nextToken
252+
}
253+
}
254+
`;

src/graphql/schema.json

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,71 @@
138138
},
139139
"isDeprecated" : false,
140140
"deprecationReason" : null
141+
}, {
142+
"name" : "listLessonsByClass",
143+
"description" : null,
144+
"args" : [ {
145+
"name" : "classId",
146+
"description" : null,
147+
"type" : {
148+
"kind" : "SCALAR",
149+
"name" : "ID",
150+
"ofType" : null
151+
},
152+
"defaultValue" : null
153+
}, {
154+
"name" : "startTime",
155+
"description" : null,
156+
"type" : {
157+
"kind" : "INPUT_OBJECT",
158+
"name" : "ModelStringKeyConditionInput",
159+
"ofType" : null
160+
},
161+
"defaultValue" : null
162+
}, {
163+
"name" : "sortDirection",
164+
"description" : null,
165+
"type" : {
166+
"kind" : "ENUM",
167+
"name" : "ModelSortDirection",
168+
"ofType" : null
169+
},
170+
"defaultValue" : null
171+
}, {
172+
"name" : "filter",
173+
"description" : null,
174+
"type" : {
175+
"kind" : "INPUT_OBJECT",
176+
"name" : "ModelLessonFilterInput",
177+
"ofType" : null
178+
},
179+
"defaultValue" : null
180+
}, {
181+
"name" : "limit",
182+
"description" : null,
183+
"type" : {
184+
"kind" : "SCALAR",
185+
"name" : "Int",
186+
"ofType" : null
187+
},
188+
"defaultValue" : null
189+
}, {
190+
"name" : "nextToken",
191+
"description" : null,
192+
"type" : {
193+
"kind" : "SCALAR",
194+
"name" : "String",
195+
"ofType" : null
196+
},
197+
"defaultValue" : null
198+
} ],
199+
"type" : {
200+
"kind" : "OBJECT",
201+
"name" : "ModelLessonConnection",
202+
"ofType" : null
203+
},
204+
"isDeprecated" : false,
205+
"deprecationReason" : null
141206
} ],
142207
"inputFields" : null,
143208
"interfaces" : [ ],
@@ -3585,23 +3650,6 @@
35853650
"onOperation" : false,
35863651
"onFragment" : false,
35873652
"onField" : false
3588-
}, {
3589-
"name" : "deprecated",
3590-
"description" : null,
3591-
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
3592-
"args" : [ {
3593-
"name" : "reason",
3594-
"description" : null,
3595-
"type" : {
3596-
"kind" : "SCALAR",
3597-
"name" : "String",
3598-
"ofType" : null
3599-
},
3600-
"defaultValue" : "\"No longer supported\""
3601-
} ],
3602-
"onOperation" : false,
3603-
"onFragment" : false,
3604-
"onField" : false
36053653
}, {
36063654
"name" : "aws_auth",
36073655
"description" : "Directs the schema to enforce authorization on a field",
@@ -3623,6 +3671,23 @@
36233671
"onOperation" : false,
36243672
"onFragment" : false,
36253673
"onField" : false
3674+
}, {
3675+
"name" : "deprecated",
3676+
"description" : null,
3677+
"locations" : [ "FIELD_DEFINITION", "ENUM_VALUE" ],
3678+
"args" : [ {
3679+
"name" : "reason",
3680+
"description" : null,
3681+
"type" : {
3682+
"kind" : "SCALAR",
3683+
"name" : "String",
3684+
"ofType" : null
3685+
},
3686+
"defaultValue" : "\"No longer supported\""
3687+
} ],
3688+
"onOperation" : false,
3689+
"onFragment" : false,
3690+
"onField" : false
36263691
}, {
36273692
"name" : "aws_subscribe",
36283693
"description" : "Tells the service which mutation triggers this subscription.",

0 commit comments

Comments
 (0)