cslms-api/internal/models/userquizpaper.go

75 lines
3.8 KiB
Go
Raw Normal View History

2023-12-27 17:31:49 +09:00
package models
import (
"time"
)
type UserQuizPaper 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 (UserQuizPaper) TableName() string {
return "UserQuizPapers"
}
type UserQuizPaperRequest struct {
2023-12-29 00:27:12 +09:00
QuizPaperID int64 `json:"quiz_paper_id" example:"1000002"`
Users []int64 `json:"users" example:"1000001,1000002,1000003,1000004"`
2023-12-27 17:31:49 +09:00
}
type UserQuizPaperResponse 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:"홍"`
2023-12-27 17:31:49 +09:00
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"`
2023-12-27 17:31:49 +09:00
StartAt *time.Time `json:"start_at"`
DoneAt *time.Time `json:"done_at"`
CreatedAt *time.Time `json:"created_at"`
2023-12-27 17:31:49 +09:00
}
type UserQuizPaperUpdateRequest struct {
QuizPaperID int64 `json:"quiz_paper_id" example:"1000002"`
UserID int64 `json:"user_id" example:"1000003"`
UserScore float32 `json:"user_score" example:"5"`
TotalScore float32 `json:"total_score" example:"100"`
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 UserQuizPaperPatchRequest 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 UserQuizPaperListResponse struct {
Data []UserQuizPaperResponse `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"`
2023-12-27 17:31:49 +09:00
}