Skip to content
Snippets Groups Projects
challenge.model.ts 1.28 KiB
Newer Older
  • Learn to ignore specific revisions
  • import { UserChallengeState, UserChallengeSuccess } from 'enums'
    
    import { DateTime } from 'luxon'
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    import {
      Dataload,
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
      UserAction,
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
      UserActionEntity,
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
      UserDuel,
      UserDuelEntity,
      UserExploration,
      UserQuiz,
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    } from 'models'
    
    export interface ChallengeState {
    
      userChallengeList: UserChallenge[]
    
      currentChallenge: UserChallenge | null
    
      currentDataload: Dataload[]
    
    export interface ChallengeEntity {
    
      id: string
      title: string
      description: string
      target: number
    
      relationships: {
        quiz: {
          data: Relation
        }
        duel: {
          data: Relation
        }
        exploration: { data: Relation[] }
      }
    
    export interface UserChallengeEntity {
    
      title_line_return?: string
    
      state: UserChallengeState
    
      target: number
    
      progress: {
        quizProgress: number
        explorationProgress: number
        actionProgress: number
      }
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      duel: UserDuelEntity
    
      success: UserChallengeSuccess
    
      startDate: string | null
      endingDate: string | null
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      quiz: UserQuiz
    
      exploration: UserExploration
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
      action: UserActionEntity
    
    export interface UserChallenge
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
      extends Omit<
        UserChallengeEntity,
        'startDate' | 'endingDate' | 'duel' | 'action'
      > {
    
      startDate: DateTime | null
      endingDate: DateTime | null
    
    Yoan VALLET's avatar
    Yoan VALLET committed
      duel: UserDuel
    
    Guilhem CARRON's avatar
    Guilhem CARRON committed
      action: UserAction