Skip to content
Snippets Groups Projects
quiz.model.ts 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • import {
      CustomQuestionType,
    
      UserQuestionState,
      UserQuizState,
    
    Rémi PAPIN's avatar
    Rémi PAPIN committed
    import { DateTime } from 'luxon'
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    
    export interface Answer {
    
    ahautbois's avatar
    ahautbois committed
      answerLabel: string
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      isTrue: boolean
    }
    
    export interface QuestionEntity {
      questionLabel: string
      answers: Answer[]
      explanation: string
      source: string
    }
    
    export interface UserQuestion extends QuestionEntity {
    
      result: UserQuestionState
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    }
    
    export interface CustomQuestionEntity {
      questionLabel: string
      type: CustomQuestionType
      timeStep: TimeStep
      interval: TimeStep
    
    Rémi PAPIN's avatar
    Rémi PAPIN committed
      period: CustomPeriod
    
      singleFluid: boolean
    
    Rémi PAPIN's avatar
    Rémi PAPIN committed
    }
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
    
    export interface UserCustomQuestion extends CustomQuestionEntity {
      result: UserQuestionState
    }
    
    Rémi PAPIN's avatar
    Rémi PAPIN committed
    export interface CustomPeriod {
      day?: number
      month?: number
      year?: number
    
      weekday?: number
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    }
    export interface QuizEntity {
      id: string
      questions: QuestionEntity[]
      customQuestion: CustomQuestionEntity
    
      startDate: string | null
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    }
    
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
    export interface UserQuiz
    
      extends Omit<QuizEntity, 'questions' | 'customQuestion' | 'startDate'> {
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      questions: UserQuestion[]
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
      customQuestion: UserCustomQuestion
    
      state: UserQuizState
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      result: number
    
      startDate: DateTime | null
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    }
    
    Rémi PAPIN's avatar
    Rémi PAPIN committed
    export interface IntervalAnswer {
      date: DateTime
      value: number
    }
    export interface OtherAnswer {
      value: number
    }