memos/api/user.go

41 lines
874 B
Go
Raw Normal View History

2021-12-08 18:43:14 +03:00
package api
2022-02-03 10:32:03 +03:00
type User struct {
Id int `jsonapi:"primary,user"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
Name string `jsonapi:"attr,name"`
Password string
OpenId string `jsonapi:"attr,openId"`
2021-12-08 18:43:14 +03:00
}
2022-02-03 10:32:03 +03:00
type UserCreate struct {
Name string `jsonapi:"attr,name"`
Password string `jsonapi:"attr,password"`
OpenId string `jsonapi:"attr,openId"`
2021-12-09 17:02:57 +03:00
}
2022-02-03 10:32:03 +03:00
type UserPatch struct {
Id int
2021-12-14 15:40:24 +03:00
2022-02-03 10:32:03 +03:00
Name *string `jsonapi:"attr,name"`
Password *string `jsonapi:"attr,password"`
OpenId *string
2021-12-14 15:40:24 +03:00
2022-02-03 10:32:03 +03:00
ResetOpenId *bool `jsonapi:"attr,resetOpenId"`
2021-12-14 15:40:24 +03:00
}
2022-02-03 10:32:03 +03:00
type UserFind struct {
Id *int `jsonapi:"attr,id"`
2021-12-09 17:02:57 +03:00
2022-02-03 10:32:03 +03:00
Name *string `jsonapi:"attr,name"`
OpenId *string
2021-12-08 18:43:14 +03:00
}
2022-02-03 10:32:03 +03:00
type UserService interface {
CreateUser(create *UserCreate) (*User, error)
PatchUser(patch *UserPatch) (*User, error)
FindUser(find *UserFind) (*User, error)
2021-12-08 18:43:14 +03:00
}