2021-11-08 04:53:03 +00:00
|
|
|
package usermngmt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
|
)
|
|
|
|
|
|
|
|
// User ...
|
|
|
|
type User struct {
|
2021-11-08 08:34:20 +00:00
|
|
|
ID primitive.ObjectID `bson:"_id" json:"_id"`
|
|
|
|
Name string `bson:"name" json:"name"`
|
|
|
|
Phone string `bson:"phone" json:"phone"` // unique
|
|
|
|
Email string `bson:"email" json:"email"` // unique
|
2021-11-08 10:04:01 +00:00
|
|
|
HashedPassword string `bson:"hashedPassword" json:"-"`
|
2021-11-08 08:34:20 +00:00
|
|
|
Status string `bson:"status" json:"status"`
|
2021-11-08 10:04:01 +00:00
|
|
|
RoleID primitive.ObjectID `bson:"roleId" json:"roleId"`
|
2021-11-08 08:34:20 +00:00
|
|
|
Other string `bson:"other" json:"other"`
|
|
|
|
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
|
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
|
|
|
}
|
|
|
|
|
2021-11-09 04:48:24 +00:00
|
|
|
// ResponseUser ...
|
|
|
|
type ResponseUser struct {
|
|
|
|
ID string `json:"_id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Phone string `json:"phone"`
|
|
|
|
Email string `json:"email"`
|
|
|
|
Status string `json:"status"`
|
|
|
|
Role RoleShort `json:"role"`
|
|
|
|
Other string `json:"other"`
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
|
|
}
|
|
|
|
|
2021-11-08 08:34:20 +00:00
|
|
|
// Role ...
|
|
|
|
type Role struct {
|
|
|
|
ID primitive.ObjectID `bson:"_id" json:"_id"`
|
|
|
|
Name string `bson:"name" json:"name"`
|
|
|
|
Code string `bson:"code" json:"code"`
|
|
|
|
IsAdmin bool `bson:"isAdmin" json:"isAdmin"`
|
|
|
|
CreatedAt time.Time `bson:"createdAt" json:"createdAt"`
|
|
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
|
2021-11-08 04:53:03 +00:00
|
|
|
}
|
2021-11-09 04:48:24 +00:00
|
|
|
|
|
|
|
type RoleShort struct {
|
|
|
|
ID string `json:"_id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
IsAdmin bool `json:"isAdmin"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type (
|
|
|
|
// ResponseUserAll ...
|
|
|
|
ResponseUserAll struct {
|
|
|
|
List []ResponseUser `json:"list"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
}
|
|
|
|
)
|