package models import ( "time" "gorm.io/datatypes" ) type UserQuiz struct { ID int64 `json:"id" db:"id" example:"1000001" gorm:"column:id;primary_key;"` GUID string `json:"guid_id" db:"guid_id" example:"2036023a-fb56-4b6c-b3bb-c787c681ada6" gorm:"column:guid_id;size:255;index;"` CenterID int64 `json:"center_id" db:"center_id" example:"100001" gorm:"column:center_id;index;"` UserQuizPaperID int64 `json:"user_quiz_paper_id" db:"user_quiz_paper_id" example:"1000001" gorm:"column:user_quiz_paper_id;index;"` UserID int64 `json:"user_id" db:"user_id" example:"1000001" gorm:"column:user_id;index;"` QuizID int64 `json:"quiz_id" db:"quiz_id" example:"1000001" gorm:"column:quiz_id;index;"` No int `json:"vol_no" db:"vol_no" example:"5" gorm:"column:vol_no;index;"` QuestionType string `json:"question_type" db:"question_type" example:"choice" gorm:"column:question_type;size:10;index;"` Question string `json:"question" db:"question" example:"퀴즈 질문입니다." gorm:"column:question;size:512;"` Content datatypes.JSON `json:"content" db:"content" gorm:"column:content;"` Answer datatypes.JSON `json:"answer,omitempty" db:"answer" gorm:"column:answer;default:'[]';"` Status string `json:"status" db:"status" example:"waiting" gorm:"column:status;size:10;index;"` Result string `json:"result" db:"result" example:"success" gorm:"column:result;size:10;index;"` Score float32 `json:"score" db:"score" example:"10" gorm:"column:score;"` UpdatedAt time.Time `json:"-" gorm:"column:updated_at;type:DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;index;->:false"` CreatedAt time.Time `json:"-" gorm:"column:created_at;type:DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;index;->:false;<-:create"` } // 테이블이름 정의 func (UserQuiz) TableName() string { return "UserQuizs" } type UserQuizRequest struct { CenterID int64 `json:"center_id" example:"1000001"` UserQuizPaperID int64 `json:"quiz_paper_id" example:"1000001"` UserID int64 `json:"user_id" example:"1000001"` QuizID int64 `json:"quiz_id" example:"1000001"` No int `json:"vol_no" example:"1"` QuestionType string `json:"question_type" example:"choice"` Question string `json:"question" example:"질문입니다."` Content QuizContent `json:"content"` Answer []string `json:"answer" example:"option1,option2"` Status string `json:"status" example:"waiting"` Result string `json:"result" example:"success"` Score float32 `json:"score" example:"10"` } type UserQuizResponse struct { ID int64 `json:"id" example:"1000001"` GUID string `json:"guid_id" example:"2036023a-fb56-4b6c-b3bb-c787c681ada6"` CenterD string `json:"center_id" example:"2036023a-fb56-4b6c-b3bb-c787c681ada6"` UserQuizPaperID int64 `json:"user_quiz_paper_id" example:"1000001"` UserID int64 `json:"user_id" example:"1000001"` QuizID int64 `json:"quiz_id" example:"1000001"` No int `json:"vol_no" example:"5"` QuestionType string `json:"question_type" example:"check"` Question string `json:"question" example:"퀴즈 질문입니다."` Content QuizContent `json:"content"` Answer []string `json:"answer" example:"option1,option2"` Status string `json:"status" example:"waiting"` Result string `json:"result" example:"success"` Score float32 `json:"score" example:"10"` } type UserQuizListResponse struct { Data []UserQuizResponse `json:"data"` Total int64 `json:"total" example:"5"` Page int `json:"page" example:"1"` TotalPage int64 `json:"totalPage" example:"1"` PageSize int `json:"pageSize" example:"10"` } type AnswerQuizRequest struct { Answer []string `json:"answer" example:"option1,option4"` }