usermngmt/model/db.go

48 lines
1.7 KiB
Go
Raw Normal View History

2021-11-10 02:54:49 +00:00
package model
2021-11-09 07:16:34 +00:00
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
2021-11-10 01:44:22 +00:00
// DBRole ...
type DBRole struct {
2021-11-10 07:50:43 +00:00
ID primitive.ObjectID `bson:"_id"`
Name string `bson:"name"`
Code string `bson:"code"`
IsAdmin bool `bson:"isAdmin"`
2021-11-12 05:16:38 +00:00
Level int `bson:"level"`
2021-11-10 07:50:43 +00:00
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt"`
2021-11-10 01:44:22 +00:00
}
// DBUser ...
type DBUser struct {
2021-11-17 06:32:29 +00:00
ID primitive.ObjectID `bson:"_id"`
Name string `bson:"name"`
SearchString string `bson:"searchString"`
Phone string `bson:"phone"` // unique
Email string `bson:"email"` // unique
HashedPassword string `bson:"hashedPassword"`
Status string `bson:"status"`
RoleID primitive.ObjectID `bson:"roleId"`
RequireToChangePassword bool `bson:"requireToChangePassword"`
2021-11-22 10:35:21 +00:00
Avatar interface{} `bson:"avatar"`
2021-11-17 06:32:29 +00:00
Deleted bool `bson:"deleted"`
2021-11-19 04:17:58 +00:00
Other interface{} `bson:"other"` // object
2021-11-17 06:32:29 +00:00
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt"`
2021-11-09 07:16:34 +00:00
}
2021-11-10 09:06:33 +00:00
// DBPermission ...
type DBPermission struct {
ID primitive.ObjectID `bson:"_id"`
Name string `bson:"name"`
Code string `bson:"code"`
RoleID primitive.ObjectID `bson:"roleId"`
Desc string `bson:"desc"`
CreatedAt time.Time `bson:"createdAt"`
UpdatedAt time.Time `bson:"updatedAt"`
}