Files
SNCTF/type/userTypes.go
2022-07-18 16:34:09 +08:00

176 lines
5.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package types
// LoginRequest 定义接收登录数据的结构体。
type LoginRequest struct {
// binding:"required"修饰的字段,若接收为空值,则报错,是必须字段
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Remember bool `json:"remember"`
}
// RegisterRequest 定义接收注册数据的结构体。
type RegisterRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Email string `json:"email" binding:"required"`
CaptchaID string `json:"captchaid" binding:"required"`
Solution string `json:"solution" binding:"required"`
}
// InfoRequest 定义接收用户修改信息的结构体。
type InfoRequest struct {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Affiliation string `json:"affiliation"`
Country string `json:"country"`
Website string `json:"website"`
}
// InstallRequest 定义接收installRequest数据的结构体。
type InstallRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
Email string `json:"email" binding:"required"`
}
// SubmissionRequest 定义接收提交flag数据的结构体。
type SubmissionRequest struct {
Cid int `json:"cid" binding:"required"`
Flag string `json:"flag" binding:"required"`
}
// StudentInfo 定义校内学生信息结构体。
type StudentInfo struct {
Username string `json:"username"`
StudentID string `json:"student_id"`
QQ string `json:"qq"`
}
// SubmitStudentInfoRequest 定义接收提交校内学生用户信息的结构体。
type SubmitStudentInfoRequest struct {
Student1 StudentInfo `json:"student1" binding:"required"`
Student2 StudentInfo `json:"student2"`
Student3 StudentInfo `json:"student3"`
Student4 StudentInfo `json:"student4"`
}
// OthersInfo 定义校外用户信息结构体。
type OthersInfo struct {
Username string `json:"username"`
Email string `json:"email"`
QQ string `json:"qq"`
}
// SubmitOthersInfoRequest 定义接收提交校外学生用户信息的结构体。
type SubmitOthersInfoRequest struct {
Others1 OthersInfo `json:"others1" binding:"required"`
Others2 OthersInfo `json:"others2"`
Others3 OthersInfo `json:"others3"`
Others4 OthersInfo `json:"others4"`
}
// ScoreResponse 定义返回得分情况结构体。
type ScoreResponse struct {
ID int `json:"id"`
Username string `json:"username"`
Score int `json:"score"`
}
// SolveResponse 定义返回解题情况结构体。
type SolveResponse struct {
ID int `json:"id"`
Uid int `json:"uid"`
Cid int `json:"cid"`
Username string `json:"username"`
ChallengeName string `json:"challenge_name"`
SubmittedAt int `json:"submitted_at"`
Score int `json:"score"`
}
// PublicInfoResponse 定义返回用户公开信息结构体。
type PublicInfoResponse struct {
Username string `json:"username"`
Affiliation string `json:"affiliation"`
Country string `json:"country"`
TeamID int `json:"team_id"`
Website string `json:"website"`
}
// PublicAllInfoResponse 定义返回所有用户公开信息结构体 暂时不显示队伍名称
type PublicAllInfoResponse struct {
Id string `json:"id"`
Username string `json:"username"`
Affiliation string `json:"affiliation"`
Country string `json:"country"`
Website string `json:"website"`
TeamID string `json:"team_id"`
Hidden string `json:"hidden"`
}
// AllInfoResponse 定义返回所有用户公开信息结构体
type AllInfoResponse struct {
Id string `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Affiliation string `json:"affiliation"`
Country string `json:"country"`
Website string `json:"website"`
TeamID string `json:"team_id"`
Hidden string `json:"hidden"`
Banned string `json:"banned"`
Role string `json:"role"`
}
// EditInfoRequest 定义修改用户信息的结构体
type EditInfoRequest struct {
Id string `json:"id"`
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Affiliation string `json:"affiliation"`
Country string `json:"country"`
Website string `json:"website"`
TeamID int `json:"team_id"`
Hidden string `json:"hidden"`
Banned string `json:"banned"`
Role string `json:"role"`
}
// ChallengeResponse 定义获取题目的一个响应。
type ChallengeResponse struct {
ID int `json:"id"`
Name string `json:"name"`
Score int `json:"score"`
Description string `json:"description"` //题目描述
Attachment []string `json:"attachment"` //题目附件
Category string `json:"category"` //分类
Tags string `json:"tags"` //标签
Hints []string `json:"hints"` //提示
SolverCount int `json:"solver_count"` //解决人数
IsSolved bool `json:"is_solved"` // true已解决false未解决
}
// ScoreRankResponse 定义获取当前用户分数和排名的一个响应。
type ScoreRankResponse struct {
Score int `json:"score"`
Rank int `json:"rank"`
}
// StudentsOrOthersInfoResponse 定义获取校内用户或校外用户信息的响应。
type StudentsOrOthersInfoResponse struct {
Username string `json:"username"`
IDOrEmail string `json:"id_email"`
QQ string `json:"qq"`
}
// UpdateUserInfoResponse 定义更新用户信息的响应
type UpdateUserInfoRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Country string `json:"country"`
Website string `json:"website"`
Affiliation string `json:"affiliation"`
}