60 lines
3.1 KiB
Go
60 lines
3.1 KiB
Go
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"`
|
|
}
|