Terminado sprint 2A
This commit is contained in:
52
lib/types.ts
Normal file
52
lib/types.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
export type QuestionType =
|
||||
| 'single_choice'
|
||||
| 'multiple_choice'
|
||||
| 'rating'
|
||||
| 'text_long'
|
||||
| 'text_short'
|
||||
| 'section'
|
||||
|
||||
export interface QuestionOption {
|
||||
value: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface RatingOptions {
|
||||
min: number
|
||||
max: number
|
||||
min_label: string
|
||||
max_label: string
|
||||
}
|
||||
|
||||
export interface ConditionalRule {
|
||||
if_question: string
|
||||
op: 'eq'
|
||||
value: string
|
||||
action: 'show'
|
||||
}
|
||||
|
||||
export interface Question {
|
||||
id: string
|
||||
survey_id: string
|
||||
code: string
|
||||
type: QuestionType
|
||||
prompt: string
|
||||
position: number
|
||||
is_sensitive: boolean
|
||||
required: boolean
|
||||
max_select: number | null
|
||||
options: QuestionOption[] | RatingOptions | null
|
||||
conditional_rules: ConditionalRule[] | null
|
||||
}
|
||||
|
||||
export interface Survey {
|
||||
id: string
|
||||
title: string
|
||||
status: string
|
||||
is_anonymous: boolean
|
||||
k_threshold: number
|
||||
questions: Question[]
|
||||
}
|
||||
|
||||
// Answers keyed by question code
|
||||
export type FormAnswers = Record<string, string | string[] | number | null>
|
||||
Reference in New Issue
Block a user