forked from gotify/server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.go
94 lines (89 loc) · 2.27 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package model
// The User holds information about the credentials of a user and its application and client tokens.
type User struct {
ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
Name string `gorm:"type:varchar(180);unique_index"`
Pass []byte
Admin bool
Applications []Application
Clients []Client
Plugins []PluginConf
}
// UserExternal Model
//
// The User holds information about permission and other stuff.
//
// swagger:model User
type UserExternal struct {
// The user id.
//
// read only: true
// required: true
// example: 25
ID uint `json:"id"`
// The user name. For login.
//
// required: true
// example: unicorn
Name string `binding:"required" json:"name" query:"name" form:"name"`
// If the user is an administrator.
//
// required: true
// example: true
Admin bool `json:"admin" form:"admin" query:"admin"`
}
// CreateUserExternal Model
//
// Used for user creation.
//
// swagger:model CreateUserExternal
type CreateUserExternal struct {
// The user name. For login.
//
// required: true
// example: unicorn
Name string `binding:"required" json:"name" query:"name" form:"name"`
// If the user is an administrator.
//
// required: true
// example: true
Admin bool `json:"admin" form:"admin" query:"admin"`
// The user password. For login.
//
// required: true
// example: nrocinu
Pass string `json:"pass,omitempty" form:"pass" query:"pass" binding:"required"`
}
// UpdateUserExternal Model
//
// Used for updating a user.
//
// swagger:model UpdateUserExternal
type UpdateUserExternal struct {
// The user name. For login.
//
// required: true
// example: unicorn
Name string `binding:"required" json:"name" query:"name" form:"name"`
// If the user is an administrator.
//
// required: true
// example: true
Admin bool `json:"admin" form:"admin" query:"admin"`
// The user password. For login. Empty for using old password
//
// example: nrocinu
Pass string `json:"pass,omitempty" form:"pass" query:"pass"`
}
// UserExternalPass Model
//
// The Password for updating the user.
//
// swagger:model UserPass
type UserExternalPass struct {
// The user password. For login.
//
// required: true
// example: nrocinu
Pass string `json:"pass,omitempty" form:"pass" query:"pass" binding:"required"`
}