퀴즈 풀기/점수
This commit is contained in:
59
internal/models/paper.go
Normal file
59
internal/models/paper.go
Normal file
@ -0,0 +1,59 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Paper struct {
|
||||
ID int64 `json:"id" db:"id" example:"1000015" gorm:"column:id;primary_key;"`
|
||||
GUID string `json:"guid_id" db:"guid_id" example:"7f9329f5-2e36-4638-92d2-73064b7291a4" gorm:"column:guid_id;size:255;uniqueIndex"`
|
||||
CenterID int64 `json:"center_id" db:"center_id" example:"1000015" gorm:"column:center_id;index;"`
|
||||
QuizPaperID int64 `json:"quiz_paper_id" db:"quiz_paper_id" example:"1000001" gorm:"column:quiz_paper_id;index;"`
|
||||
UserID int64 `json:"user_id" db:"user_id" example:"1000002" gorm:"column:user_id;index;"`
|
||||
UserScore float32 `json:"user_score" db:"user_score" example:"5" gorm:"column:user_score;"`
|
||||
TotalScore float32 `json:"total_score" db:"total_score" example:"100" gorm:"column:total_score;"`
|
||||
Status string `json:"status" example:"wating" gorm:"column:status;size:10;index;"`
|
||||
StartAt *time.Time `json:"start_at" gorm:"column:start_at;index;"`
|
||||
DoneAt *time.Time `json:"done_at" gorm:"column:done_at;index;"`
|
||||
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 (Paper) TableName() string {
|
||||
return "UserQuizPapers"
|
||||
}
|
||||
|
||||
type PaperResponse struct {
|
||||
ID int64 `json:"id" db:"id" example:"1000015"`
|
||||
GUID string `json:"guid_id" db:"guid_id" example:"7f9329f5-2e36-4638-92d2-73064b7291a4"`
|
||||
CenterID int64 `json:"center_id" db:"center_id" example:"1000015"`
|
||||
QuizPaperID int64 `json:"quiz_paper_id" db:"quiz_paper_id" example:"1000001"`
|
||||
UserID int64 `json:"user_id" db:"user_id" example:"1000002"`
|
||||
FirstName string `json:"first_name" db:"first_name" example:"길순"`
|
||||
LastName string `json:"last_name" db:"last_name" example:"홍"`
|
||||
UserScore float32 `json:"user_score" db:"user_score" example:"5"`
|
||||
TotalScore float32 `json:"total_score" db:"total_score" example:"100"`
|
||||
Status string `json:"status" example:"wating"`
|
||||
Category string `json:"category" example:"파이썬기본"`
|
||||
Title string `json:"title" example:"출력 Print"`
|
||||
StartAt *time.Time `json:"start_at"`
|
||||
DoneAt *time.Time `json:"done_at"`
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
type PaperPatchRequest struct {
|
||||
UserScore float32 `json:"user_score" example:"4"`
|
||||
TotalScore float32 `json:"total_score" example:"80"`
|
||||
Status string `json:"status" example:"ready"`
|
||||
StartAt string `json:"start_at,omitempty" example:"2023-11-10T13:10:00+09:00"`
|
||||
DoneAt string `json:"done_at,omitempty" example:"2023-11-10T13:25:00+09:00"`
|
||||
}
|
||||
|
||||
type PaperListResponse struct {
|
||||
Data []PaperResponse `json:"data"`
|
||||
Total int64 `json:"total" example:"999"`
|
||||
Page int `json:"page" example:"1"`
|
||||
TotalPage int64 `json:"totalPage" example:"99"`
|
||||
PageSize int `json:"pageSize" example:"10"`
|
||||
}
|
54
internal/models/paperquiz.go
Normal file
54
internal/models/paperquiz.go
Normal file
@ -0,0 +1,54 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
type PaperQuiz 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;"`
|
||||
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 (PaperQuiz) TableName() string {
|
||||
return "UserQuizs"
|
||||
}
|
||||
|
||||
type PaperQuizResponse 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"`
|
||||
Status string `json:"status" example:"waiting"`
|
||||
Result string `json:"result" example:"success"`
|
||||
Score float32 `json:"score" example:"10"`
|
||||
}
|
||||
|
||||
type PaperQuizListResponse 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"`
|
||||
}
|
@ -69,3 +69,7 @@ type UserQuizListResponse struct {
|
||||
TotalPage int64 `json:"totalPage" example:"1"`
|
||||
PageSize int `json:"pageSize" example:"10"`
|
||||
}
|
||||
|
||||
type AnswerQuizRequest struct {
|
||||
Answer []string `json:"answer" example:"option1,option4"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user