分类:Model/Repo/Service/Controller + 管理后台树形页面 + 首页导航栏
标签:Model/Repo/Service/Controller + /tags/{slug} 落地页 + 写文章页输入
Post 加 CategoryID,Create/Update 支持分类和标签
SQL 迁移含 categories/tags/post_tags 表及预设未分类
75 lines
2.4 KiB
Go
75 lines
2.4 KiB
Go
package model
|
|
|
|
// RegisterRequest 注册请求
|
|
type RegisterRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
Password string `json:"password" binding:"required,min=8"`
|
|
ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password"`
|
|
RememberMe bool `json:"remember_me"`
|
|
}
|
|
|
|
// LoginRequest 登录请求
|
|
type LoginRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
Password string `json:"password" binding:"required"`
|
|
RememberMe bool `json:"remember_me"`
|
|
}
|
|
|
|
// CheckEmailRequest 检查邮箱是否已注册
|
|
type CheckEmailRequest struct {
|
|
Email string `json:"email" binding:"required,email"`
|
|
}
|
|
|
|
// ---- Post DTOs ----
|
|
|
|
// PostListResult 帖子列表查询结果
|
|
type PostListResult struct {
|
|
Items []Post `json:"items"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|
|
|
|
// PostCreateRequest 发帖请求
|
|
type PostCreateRequest struct {
|
|
Title string `json:"title" binding:"required,min=1,max=200"`
|
|
Body string `json:"body" binding:"required,min=1"`
|
|
Visibility string `json:"visibility"`
|
|
PostType string `json:"post_type"`
|
|
ReprintSource string `json:"reprint_source"`
|
|
Declaration string `json:"declaration"`
|
|
ReprintProhibited bool `json:"reprint_prohibited"`
|
|
CategoryID string `json:"category_id"`
|
|
Tags string `json:"tags"`
|
|
}
|
|
|
|
// PostUpdateRequest 编辑请求
|
|
type PostUpdateRequest struct {
|
|
Title string `json:"title" binding:"required,min=1,max=200"`
|
|
Body string `json:"body" binding:"required,min=1"`
|
|
Visibility string `json:"visibility"`
|
|
PostType string `json:"post_type"`
|
|
ReprintSource string `json:"reprint_source"`
|
|
Declaration string `json:"declaration"`
|
|
ReprintProhibited bool `json:"reprint_prohibited"`
|
|
CategoryID string `json:"category_id"`
|
|
Tags string `json:"tags"`
|
|
}
|
|
|
|
// PostRejectRequest 退回请求
|
|
type PostRejectRequest struct {
|
|
Reason string `json:"reason" binding:"required,min=1,max=500"`
|
|
}
|
|
|
|
// PostLockRequest 锁定请求
|
|
type PostLockRequest struct {
|
|
Reason string `json:"reason" binding:"required,min=1,max=500"`
|
|
}
|
|
|
|
// PostListQuery 列表查询参数
|
|
type PostListQuery struct {
|
|
Keyword string `form:"keyword"`
|
|
Status string `form:"status"`
|
|
Page int `form:"page"`
|
|
PageSize int `form:"page_size"`
|
|
} |