RezinaLMS-BackEnd/internal/domain/questions.go

216 lines
6.1 KiB
Go

package domain
import "time"
type QuestionType string
const (
QuestionTypeMCQ QuestionType = "MCQ"
QuestionTypeTrueFalse QuestionType = "TRUE_FALSE"
QuestionTypeShortAnswer QuestionType = "SHORT_ANSWER"
QuestionTypeAudio QuestionType = "AUDIO"
)
type DifficultyLevel string
const (
DifficultyEasy DifficultyLevel = "EASY"
DifficultyMedium DifficultyLevel = "MEDIUM"
DifficultyHard DifficultyLevel = "HARD"
)
type QuestionSetType string
const (
QuestionSetTypePractice QuestionSetType = "PRACTICE"
QuestionSetTypeQuiz QuestionSetType = "QUIZ"
QuestionSetTypeExam QuestionSetType = "EXAM"
QuestionSetTypeSurvey QuestionSetType = "SURVEY"
QuestionSetTypeCapstone QuestionSetType = "CAPSTONE"
)
type PracticeAccessBlock struct {
QuestionSetID int64
Title string
DisplayOrder int32
}
type MatchType string
const (
MatchTypeExact MatchType = "EXACT"
MatchTypeContains MatchType = "CONTAINS"
MatchTypeCaseInsensitive MatchType = "CASE_INSENSITIVE"
)
type Question struct {
ID int64
QuestionText string
QuestionType string
QuestionTypeDefinitionID *int64
DynamicPayload *DynamicQuestionPayload
DifficultyLevel *string
Points int32
Explanation *string
Tips *string
VoicePrompt *string
SampleAnswerVoicePrompt *string
ImageURL *string
Status string
CreatedAt time.Time
UpdatedAt *time.Time
}
type QuestionAudioAnswer struct {
ID int64
QuestionID int64
CorrectAnswerText string
CreatedAt time.Time
}
type QuestionWithDetails struct {
Question
Options []QuestionOption
ShortAnswers []QuestionShortAnswer
AudioAnswer *QuestionAudioAnswer
}
type QuestionOption struct {
ID int64
QuestionID int64
OptionText string
OptionOrder int32
IsCorrect bool
CreatedAt time.Time
}
type QuestionShortAnswer struct {
ID int64
QuestionID int64
AcceptableAnswer string
MatchType string
CreatedAt time.Time
}
type QuestionSet struct {
ID int64 `json:"ID"`
Title string `json:"Title"`
Description *string `json:"Description"`
SetType string `json:"SetType"`
OwnerType *string `json:"OwnerType"`
OwnerID *int64 `json:"OwnerID"`
BannerImage *string `json:"BannerImage"`
Persona *string `json:"Persona"`
TimeLimitMinutes *int32 `json:"TimeLimitMinutes"`
PassingScore *int32 `json:"PassingScore"`
ShuffleQuestions bool `json:"ShuffleQuestions"`
Status string `json:"Status"`
IntroVideoURL *string `json:"IntroVideoURL"`
UserPersonas []UserPersona `json:"UserPersonas"`
CreatedAt time.Time `json:"CreatedAt"`
UpdatedAt *time.Time `json:"UpdatedAt"`
}
type QuestionSetItem struct {
ID int64
SetID int64
QuestionID int64
DisplayOrder int32
AssociatedQuestionID *int64
StimulusBlockKey *string
CreatedAt time.Time
}
// QuestionSetQuestionTypeGroup is a raw DB aggregate before resolving builder definitions.
type QuestionSetQuestionTypeGroup struct {
QuestionTypeDefinitionID *int64
QuestionType string
Count int64
}
// QuestionSetQuestionTypeCount is one builder question type present in a set with how many questions use it.
type QuestionSetQuestionTypeCount struct {
QuestionTypeDefinitionID *int64 `json:"question_type_definition_id,omitempty"`
Key string `json:"key"`
DisplayName string `json:"display_name"`
Count int64 `json:"count"`
}
// QuestionSetQuestionTypesSummary summarizes distinct question types in a question set (e.g. linked practice).
type QuestionSetQuestionTypesSummary struct {
QuestionSetID int64 `json:"question_set_id"`
QuestionTypes []QuestionSetQuestionTypeCount `json:"question_types"`
TotalQuestions int64 `json:"total_questions"`
}
type QuestionSetItemWithQuestion struct {
QuestionSetItem
QuestionText string
QuestionType string
DynamicPayload *DynamicQuestionPayload
DifficultyLevel *string
Points int32
Explanation *string
Tips *string
VoicePrompt *string
SampleAnswerVoicePrompt *string
ImageURL *string
AudioCorrectAnswerText *string
QuestionStatus string
}
type CreateQuestionInput struct {
QuestionText string
QuestionType string
QuestionTypeDefinitionID *int64
DynamicPayload *DynamicQuestionPayload
DifficultyLevel *string
Points *int32
Explanation *string
Tips *string
VoicePrompt *string
SampleAnswerVoicePrompt *string
ImageURL *string
Status *string
Options []CreateQuestionOptionInput
ShortAnswers []CreateShortAnswerInput
AudioCorrectAnswerText *string
}
type CreateQuestionOptionInput struct {
OptionText string
OptionOrder *int32
IsCorrect bool
}
type CreateShortAnswerInput struct {
AcceptableAnswer string
MatchType *string
}
type CreateQuestionSetInput struct {
Title string
Description *string
SetType string
OwnerType *string
OwnerID *int64
BannerImage *string
Persona *string
TimeLimitMinutes *int32
PassingScore *int32
ShuffleQuestions *bool
Status *string
IntroVideoURL *string
}
// UserPersona represents a user acting as a persona in a practice session
type UserPersona struct {
ID int64 `json:"ID"`
FirstName *string `json:"FirstName"`
LastName *string `json:"LastName"`
NickName *string `json:"NickName"`
ProfilePictureURL *string `json:"ProfilePictureURL"`
Role string `json:"Role"`
DisplayOrder int32 `json:"DisplayOrder"`
}