/
user.go
62 lines (52 loc) · 1.65 KB
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package user
import (
"github.com/1024casts/snake/internal/model"
)
// CreateRequest 创建用户请求
type CreateRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
// CreateResponse 创建用户响应
type CreateResponse struct {
Username string `json:"username"`
}
// RegisterRequest 注册
type RegisterRequest struct {
Username string `json:"username" form:"username"`
Email string `json:"email" form:"email"`
Password string `json:"password" form:"password"`
ConfirmPassword string `json:"confirm_password" form:"confirm_password"`
}
// LoginCredentials 默认登录方式-邮箱
type LoginCredentials struct {
Email string `json:"email" form:"email"`
Password string `json:"password" form:"password"`
}
// PhoneLoginCredentials 手机登录
type PhoneLoginCredentials struct {
Phone int `json:"phone" form:"phone" binding:"required" example:"13010002000"`
VerifyCode int `json:"verify_code" form:"verify_code" binding:"required" example:"120110"`
}
// UpdateRequest 更新请求
type UpdateRequest struct {
Avatar string `json:"avatar"`
Sex int `json:"sex"`
}
// FollowRequest 关注请求
type FollowRequest struct {
UserID uint64 `json:"user_id"`
}
// ListResponse 通用列表resp
type ListResponse struct {
TotalCount uint64 `json:"total_count"`
HasMore int `json:"has_more"`
PageKey string `json:"page_key"`
PageValue int `json:"page_value"`
Items interface{} `json:"items"`
}
// SwaggerListResponse 文档
type SwaggerListResponse struct {
TotalCount uint64 `json:"totalCount"`
UserList []model.UserInfo `json:"userList"`
}