2020-01-14 18:22:34 -09:00
|
|
|
package model
|
2020-01-14 12:11:27 -09:00
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
|
|
type User struct {
|
2020-01-28 04:22:17 -09:00
|
|
|
ID string `json:"id" orm:"column(id)"`
|
|
|
|
|
UserName string `json:"userName"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Email string `json:"email"`
|
|
|
|
|
Password string `json:"password"`
|
|
|
|
|
IsAdmin bool `json:"isAdmin"`
|
|
|
|
|
LastLoginAt *time.Time `json:"lastLoginAt"`
|
|
|
|
|
LastAccessAt *time.Time `json:"lastAccessAt"`
|
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
|
|
|
// TODO ChangePassword string `json:"password"`
|
2020-01-14 12:11:27 -09:00
|
|
|
}
|
2020-01-19 18:36:15 -09:00
|
|
|
|
2020-01-28 04:22:17 -09:00
|
|
|
type Users []User
|
|
|
|
|
|
2020-01-19 18:36:15 -09:00
|
|
|
type UserRepository interface {
|
|
|
|
|
CountAll(...QueryOptions) (int64, error)
|
|
|
|
|
Get(id string) (*User, error)
|
|
|
|
|
Put(*User) error
|
2020-01-20 05:54:29 -09:00
|
|
|
FindByUsername(username string) (*User, error)
|
|
|
|
|
UpdateLastLoginAt(id string) error
|
2020-01-20 09:35:59 -09:00
|
|
|
UpdateLastAccessAt(id string) error
|
2020-01-19 18:36:15 -09:00
|
|
|
}
|