Skip to content

Commit

Permalink
feat: allow quiz question image
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoEscaleira committed Mar 20, 2024
1 parent 36501b8 commit 0cb9ae8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ type Query {

"""Question data"""
type QuestionData {
"""The image for this question"""
image: String!

"""The list of answers for this question"""
options: [OptionData!]!

Expand All @@ -197,6 +200,8 @@ type QuestionData {

"""The input required to create a question"""
input QuestionInput {
"""The image for this question"""
image: String
options: [OptionInput!]!

"""Question text"""
Expand Down
3 changes: 3 additions & 0 deletions src/models/quiz.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export class Question {

@prop({ required: true })
options: Option[];

@prop({ required: false, default: '' })
image: string;
}

@ModelOptions({
Expand Down
3 changes: 3 additions & 0 deletions src/schemas/quiz/quiz.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class QuestionInput {

@Field(() => [OptionInput])
options: OptionInput[];

@Field({ nullable: true, description: 'The image for this question' })
image?: string;
}

@InputType({ description: 'The input required to create a quiz' })
Expand Down
3 changes: 3 additions & 0 deletions src/schemas/quiz/quiz.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class QuestionData {

@Field(() => [OptionData], { description: 'The list of answers for this question' })
options: OptionData[];

@Field({ description: 'The image for this question' })
image?: string;
}

@ObjectType({ description: 'Quiz data' })
Expand Down

0 comments on commit 0cb9ae8

Please sign in to comment.