cslms-api/internal/models/quizpaper.go

66 lines
3.0 KiB
Go

package models
import (
"time"
"gorm.io/datatypes"
)
type QuizPaper struct {
ID int64 `json:"id" db:"id" example:"100001" gorm:"column:id;primary_key;"`
GUID string `json:"guid_id" db:"guid_id" example:"ef74c59a-c707-4162-a52b-455906c81ec1" gorm:"column:guid_id;size:255;index;"`
CenterID int64 `json:"center_id" db:"center_id" example:"100001" gorm:"column:center_id;index;"`
ManagerID int64 `json:"manager_id" db:"manager_id" example:"100001" gorm:"column:manager_id;index;"`
Title string `json:"title" db:"title" example:"퀴즈 시트 제목" gorm:"column:title;size:255;index;"`
Content string `json:"content" db:"content" example:"퀴즈 시트 설명" gorm:"column:content;size:512;"`
Category string `json:"category" db:"category" example:"파이썬기본" gorm:"column:category;size:255;"`
Tag datatypes.JSON `json:"tag" db:"tag" gorm:"column:tag;"`
Status string `json:"status" example:"on" gorm:"column:status;size:10;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:"created_at" db:"created_at" example:"2023-11-10T13:10:00+09:00" gorm:"column:created_at;type:DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;index;"`
}
// 테이블이름 정의
func (QuizPaper) TableName() string {
return "QuizPapers"
}
type QuizPaperRequest struct {
CenterID int64 `json:"center_id" example:"100001"`
Title string `json:"title" example:"퀴즈 시트 제목"`
Content string `json:"content" example:"퀴즈 시트 설명"`
Category string `json:"category" example:"파이썬기본"`
Tag []string `json:"tag" example:"Python,AI,Robot,파이썬"`
Status string `json:"status" example:"on"`
}
type QuizPaperResponse struct {
ID int64 `json:"id" example:"100001"`
CenterID int64 `json:"center_id" example:"100001"`
ManagerID int64 `json:"manager_id" example:"100001"`
Title string `json:"title" example:"퀴즈 시트 제목"`
Content string `json:"content" example:"퀴즈 시트 설명"`
Category string `json:"category" example:"파이썬기본"`
Tag []string `json:"tag" example:"Python,AI,Robot,파이썬"`
Status string `json:"status" example:"on"`
CreatedAt time.Time `json:"created_at" example:"2023-11-10T13:10:00+09:00"`
}
type QuizPaperListResponse struct {
Data []QuizPaper `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"`
}
type QuizPaperCopyRequest struct {
Title string `json:"title" example:"퀴즈 시트 제목"`
CenterID int64 `json:"center_id" example:"100002"`
}
type QuizPaperCopyResponse struct {
QuizPaper QuizPaper `json:"quiz_paper"`
Quiz []Quiz `json:"quiz"`
}