This commit is contained in:
2023-12-29 00:27:12 +09:00
parent b4a0b72f66
commit c31a16843d
35 changed files with 451 additions and 261 deletions

View File

@ -4,21 +4,6 @@ import (
"time"
)
// CREATE TABLE `Centers` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `guid_id` varchar(36) DEFAULT '',
// `center_title` varchar(50) DEFAULT '' COMMENT '강동런스팀로봇코딩학원',
// `center_name` varchar(50) DEFAULT '' COMMENT 'learnsteam_kd',
// `owner_id` bigint(20) DEFAULT 0,
// `content_page` text DEFAULT '' COMMENT '학원상세페이지, html/마크다운/text',
// `company_info` text DEFAULT '' COMMENT '사업자정보-json\r\n기타 정보 추가 가능\r\n\r\n{\r\n "company_ceo": "대표자이름",\r\n "company_code": "사업자번호",\r\n "company_phone": "대표전화번호",\r\n "company_email": "대표전자메일",\r\n "company_homepage": "대표홈페이지 url",\r\n "company_logo": "로고이미지 url",\r\n "company_cover_image": "대표 이미지", \r\n}',
// `memo` varchar(256) DEFAULT '',
// `created_at` timestamp NULL DEFAULT current_timestamp(),
// `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
// `status` varchar(10) DEFAULT NULL,
// PRIMARY KEY (`id`)
// ) ENGINE=InnoDB AUTO_INCREMENT=1000005 DEFAULT CHARSET=utf8mb4 COMMENT='Centers의 이미지/영상은 Links에서 관리됨. ';
type Center struct {
ID int64 `json:"id" db:"id" example:"100001" 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;"`

View File

@ -59,11 +59,11 @@ type QuizResponse struct {
}
type QuizListResponse struct {
Data []Quiz `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"`
Data []QuizResponse `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 QuizContent struct {

View File

@ -6,24 +6,6 @@ import (
"gorm.io/datatypes"
)
// CREATE TABLE `QuizPapers` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `guid_id` char(36) NOT NULL DEFAULT '0',
// `center_id` bigint(20) NOT NULL DEFAULT 0,
// `manager_id` bigint(20) NOT NULL DEFAULT 0,
// `title` varchar(256) NOT NULL DEFAULT '' COMMENT '퀴즈시트 제목',
// `status` varchar(10) NOT NULL DEFAULT '0' COMMENT 'on/off',
// `content` text NOT NULL DEFAULT '' COMMENT 'markdown 문서',
// `tags` varchar(256) NOT NULL DEFAULT '' COMMENT '출력,hello world,for반복문...',
// `category` varchar(256) NOT NULL DEFAULT '파이썬기본',
// `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
// `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
// PRIMARY KEY (`id`) USING BTREE,
// KEY `guid_id` (`guid_id`) USING BTREE,
// KEY `center_id` (`center_id`) USING BTREE,
// KEY `manager_id` (`manager_id`) USING BTREE
// ) ENGINE=InnoDB AUTO_INCREMENT=10000001 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='퀴즈시험지 관리 테이블\r\n\r\n';
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;"`
@ -44,23 +26,23 @@ func (QuizPaper) TableName() string {
}
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 datatypes.JSON `json:"tag"`
Status string `json:"status" example:"on"`
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 datatypes.JSON `json:"tag"`
Status string `json:"status" example:"on"`
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"`
}
type QuizPaperListResponse struct {

View File

@ -2,17 +2,6 @@ package models
import "time"
// CREATE TABLE `UserTokens` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `user_id` bigint(20) DEFAULT 0,
// `token` varchar(256) DEFAULT '',
// `refresh_token` varchar(256) DEFAULT '',
// `status` varchar(3) DEFAULT 'on' COMMENT 'on/off',
// `register_at` timestamp NULL DEFAULT current_timestamp(),
// `ending_at` timestamp NULL DEFAULT NULL COMMENT '종료날짜',
// PRIMARY KEY (`id`) USING BTREE
// ) ENGINE=InnoDB AUTO_INCREMENT=1000017 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
type Token struct {
ID int64 `json:"-" db:"id" gorm:"primary_key"`
UserID int64 `json:"user_id" db:"user_id" gorm:"index;"`

View File

@ -2,27 +2,6 @@ package models
import "time"
// CREATE TABLE `Users` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `guid_id` longtext DEFAULT NULL,
// `first_name` longtext DEFAULT NULL,
// `last_name` longtext DEFAULT NULL,
// `user_name` longtext DEFAULT NULL,
// `password` longtext DEFAULT NULL,
// `gender` char(1) DEFAULT 'M' COMMENT 'M(남)/F(여)',
// `user_role` longtext DEFAULT NULL,
// `memo_cs` longtext DEFAULT NULL,
// `register_at` datetime(3) DEFAULT NULL,
// `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '업데이트될때마다 자동저장',
// `phone_cs` longtext DEFAULT NULL,
// `upload_image` longtext DEFAULT NULL,
// PRIMARY KEY (`id`) USING BTREE,
// KEY `guid_id` (`guid_id`(768)),
// KEY `first_name` (`first_name`(768)),
// KEY `last_name` (`last_name`(768)),
// KEY `user_name` (`user_name`(768))
// ) ENGINE=InnoDB AUTO_INCREMENT=1000023 DEFAULT CHARSET=utf8mb4;
type User struct {
ID int64 `json:"id" db:"id" example:"100001" gorm:"column:id;primary_key;"`
GUID string `json:"guid_id" db:"guid_id" example:"137c1683-2ad6-4201-b256-253828b61c49" gorm:"column:guid_id;size:255;"`

View File

@ -12,6 +12,7 @@ type UserQuiz struct {
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;"`
@ -33,6 +34,7 @@ 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:"질문입니다."`
@ -49,6 +51,7 @@ type UserQuizResponse struct {
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:"퀴즈 질문입니다."`

View File

@ -2,30 +2,8 @@ package models
import (
"time"
"gorm.io/datatypes"
)
// CREATE TABLE `UserQuizPapers` (
// `id` bigint(20) NOT NULL AUTO_INCREMENT,
// `guid_id` char(36) NOT NULL DEFAULT '0',
// `center_id` bigint(20) NOT NULL DEFAULT 0,
// `quiz_paper_id` bigint(20) NOT NULL DEFAULT 0,
// `status` varchar(10) NOT NULL DEFAULT '0' COMMENT '매칭된 학생퀴즈시험지 상태: \r\nwaiting(대기)/processing(시험진행중)/abort(취소)/marking(채점중)/done(완료) ',
// `user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '매칭된 학생',
// `user_score` float NOT NULL DEFAULT 5 COMMENT '10',
// `total_score` float NOT NULL DEFAULT 100 COMMENT '100.0, 5.0',
// `start_at` timestamp NULL DEFAULT NULL COMMENT '학생시험시작시각',
// `done_at` timestamp NULL DEFAULT NULL COMMENT '학생시험종료시각',
// `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
// `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
// PRIMARY KEY (`id`) USING BTREE,
// KEY `guid_id` (`guid_id`) USING BTREE,
// KEY `center_id` (`center_id`) USING BTREE,
// KEY `user_id` (`user_id`),
// KEY `manager_id` (`quiz_paper_id`) USING BTREE
// ) ENGINE=InnoDB AUTO_INCREMENT=10000001 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='학생퀴즈시험지 매칭\r\n';
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"`
@ -47,8 +25,8 @@ func (UserQuizPaper) TableName() string {
}
type UserQuizPaperRequest struct {
QuizPaperID int64 `json:"quiz_paper_id" example:"1000002"`
Users datatypes.JSON `json:"users"`
QuizPaperID int64 `json:"quiz_paper_id" example:"1000002"`
Users []int64 `json:"users" example:"1000001,1000002,1000003,1000004"`
}
type UserQuizPaperResponse struct {