Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit 218b2b7

Browse files
authored
BE-add-quizList-Before-In-After-Class (#997)
1 parent acd6c28 commit 218b2b7

4 files changed

Lines changed: 42 additions & 0 deletions

File tree

packages/server/schema.gql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ type Lesson implements BaseModel {
9090
classworkAssignmentListBeforeClass: [ID!]
9191
classworkAssignmentListInClass: [ID!]
9292
classworkAssignmentListAfterClass: [ID!]
93+
quizListBeforeClass: [ID!]
94+
quizListInClass: [ID!]
95+
quizListAfterClass: [ID!]
9396
}
9497

9598
type LessonsPayload {
@@ -762,6 +765,9 @@ input UpdateLessonInput {
762765
classworkAssignmentListBeforeClass: [String!]
763766
classworkAssignmentListInClass: [String!]
764767
classworkAssignmentListAfterClass: [String!]
768+
quizListBeforeClass: [String!]
769+
quizListInClass: [String!]
770+
quizListAfterClass: [String!]
765771
}
766772

767773
enum UpdateLessonTimeOptions {

packages/server/src/modules/lesson/lesson.service.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ export class LessonService {
347347
classworkAssignmentListBeforeClass,
348348
classworkAssignmentListInClass,
349349
classworkAssignmentListAfterClass,
350+
quizListBeforeClass,
351+
quizListInClass,
352+
quizListAfterClass,
350353
} = updateInput
351354
const { lessonModel, courseModel } = this
352355

@@ -523,6 +526,18 @@ export class LessonService {
523526
classworkAssignmentListAfterClass
524527
}
525528

529+
if (quizListBeforeClass) {
530+
lesson.quizListBeforeClass = quizListBeforeClass
531+
}
532+
533+
if (quizListInClass) {
534+
lesson.quizListInClass = quizListInClass
535+
}
536+
537+
if (quizListAfterClass) {
538+
lesson.quizListAfterClass = quizListAfterClass
539+
}
540+
526541
lesson.updatedByAccountId = updatedByAccountId
527542

528543
const update = await lesson.save()

packages/server/src/modules/lesson/lesson.type.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ export class UpdateLessonInput {
124124

125125
@Field((_type) => [String], { nullable: true })
126126
classworkAssignmentListAfterClass?: string[]
127+
128+
@Field((_type) => [String], { nullable: true })
129+
quizListBeforeClass?: string[]
130+
131+
@Field((_type) => [String], { nullable: true })
132+
quizListInClass?: string[]
133+
134+
@Field((_type) => [String], { nullable: true })
135+
quizListAfterClass?: string[]
127136
}
128137

129138
@InputType()

packages/server/src/modules/lesson/models/Lesson.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,16 @@ export class Lesson extends BaseModel {
7373
@Field((_type) => [ID], { nullable: true })
7474
@prop({ type: [Types.ObjectId], required: false, default: [] })
7575
classworkAssignmentListAfterClass: string[]
76+
77+
@Field((_type) => [ID], { nullable: true })
78+
@prop({ type: [Types.ObjectId], required: false, default: [] })
79+
quizListBeforeClass: string[]
80+
81+
@Field((_type) => [ID], { nullable: true })
82+
@prop({ type: [Types.ObjectId], required: false, default: [] })
83+
quizListInClass: string[]
84+
85+
@Field((_type) => [ID], { nullable: true })
86+
@prop({ type: [Types.ObjectId], required: false, default: [] })
87+
quizListAfterClass: string[]
7688
}

0 commit comments

Comments
 (0)