implement user authentication and database initialization, add models for user, comment, label, and OIDC configuration

This commit is contained in:
2025-07-22 06:18:23 +08:00
parent 99a3f80e12
commit d1a040617f
23 changed files with 602 additions and 19 deletions

7
internal/dto/dto.go Normal file
View File

@ -0,0 +1,7 @@
package dto
type BaseResp struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data"`
}

33
internal/dto/user.go Normal file
View File

@ -0,0 +1,33 @@
package dto
type UserDto struct {
Username string `json:"username"` // 用户名
Nickname string `json:"nickname"`
AvatarUrl string `json:"avatar_url"` // 头像URL
Email string `json:"email"` // 邮箱
Gender string `json:"gender"`
Role string `json:"role"`
}
type UserLoginReq struct {
Username string `json:"username"` // username or email
Password string `json:"password"`
}
type UserLoginResp struct {
Token string `json:"token"`
RefreshToken string `json:"refresh_token"`
User UserDto `json:"user"`
}
type UserRegisterReq struct {
Username string `json:"username"` // 用户名
Nickname string `json:"nickname"` // 昵称
Password string `json:"password"` // 密码
Email string `json:"email"` // 邮箱
}
type UserRegisterResp struct {
Token string `json:"token"` // 访问令牌
RefreshToken string `json:"refresh_token"` // 刷新令牌
User UserDto `json:"user"` // 用户信息
}