memos/api/user.go

50 lines
916 B
Go
Raw Normal View History

2021-12-08 23:43:14 +08:00
package api
2022-02-03 15:32:03 +08:00
type User struct {
Id int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
2022-02-03 15:32:03 +08:00
2022-02-06 16:19:20 +08:00
OpenId string `json:"openId"`
Name string `json:"name"`
PasswordHash string `json:"-"`
2021-12-08 23:43:14 +08:00
}
2022-02-03 15:32:03 +08:00
type UserCreate struct {
2022-02-06 16:19:20 +08:00
OpenId string
Name string
PasswordHash string
2021-12-09 22:02:57 +08:00
}
2022-02-03 15:32:03 +08:00
type UserPatch struct {
Id int
2021-12-14 20:40:24 +08:00
2022-02-06 16:19:20 +08:00
OpenId *string
PasswordHash *string
2021-12-14 20:40:24 +08:00
Name *string `json:"name"`
Password *string `json:"password"`
ResetOpenId *bool `json:"resetOpenId"`
2021-12-14 20:40:24 +08:00
}
2022-02-03 15:32:03 +08:00
type UserFind struct {
Id *int `json:"id"`
2021-12-09 22:02:57 +08:00
2022-02-06 16:19:20 +08:00
Name *string `json:"name"`
OpenId *string
2021-12-08 23:43:14 +08:00
}
type UserRenameCheck struct {
Name string `json:"name"`
}
type UserPasswordCheck struct {
Password string `json:"password"`
}
2022-02-03 15:32:03 +08:00
type UserService interface {
CreateUser(create *UserCreate) (*User, error)
PatchUser(patch *UserPatch) (*User, error)
FindUser(find *UserFind) (*User, error)
2021-12-08 23:43:14 +08:00
}