authentication/struct.go

86 lines
2.1 KiB
Go
Raw Normal View History

2022-05-23 07:04:01 +00:00
package authentication
2022-05-24 03:14:51 +00:00
import (
"github.com/Selly-Modules/natsio"
)
2022-05-24 07:31:45 +00:00
// Role ...
type Role struct {
ID string `bson:"_id"`
Name string `bson:"name"`
CreatedAt string `bson:"createdAt"`
UpdatedAt string `bson:"updatedAt"`
Permissions []string `bson:"permissions"`
}
// ListRole ...
type ListRole struct {
Roles []Role `json:"roles"`
}
2022-05-24 03:14:51 +00:00
// Staff ...
type Staff struct {
ID string `json:"_id"` // ObjectID
Name string `json:"name"`
Phone string `json:"phone"`
Active bool `json:"active"`
Role string `json:"role,omitempty"` // ObjectID
Avatar []byte `json:"avatar,omitempty"` // FilePhoto
CreatedAt string `json:"createdAt"` // ISOString
UpdatedAt string `json:"updatedAt"` // ISOString
IsRoot bool `json:"isRoot"`
Permissions []string `json:"permissions"`
NotAllowedLoginAdmin bool `json:"notAllowedLoginAdmin"`
Source []string `json:"source"`
}
// ListStaff ...
type ListStaff struct {
Staffs []Staff `json:"staffs"`
}
2022-05-23 07:04:01 +00:00
// Config int client elasticsearch
type Config struct {
ApiKey string
Nats natsio.Config
}
// StaffCheckPermissionBody ...
type StaffCheckPermissionBody struct {
StaffID string `json:"staffId"`
Permission string `json:"permission"`
Source string `json:"source"`
Code string `json:"code,omitempty"`
}
// StaffCheckPermissionResponse ...
type StaffCheckPermissionResponse struct {
Message string `json:"message"`
IsValid bool `json:"isValid"`
}
// StaffGetPermissions ...
type StaffGetPermissions struct {
StaffID string `json:"staffId"`
Source string `json:"source"`
}
// StaffGetPermissionsResponse ...
type StaffGetPermissionsResponse struct {
Permissions []string `json:"permissions"`
}
// RequestBody ...
type RequestBody struct {
Body []byte `json:"body"`
ApiKey string `json:"apiKey"`
}
// Response
// response to service es
type Response struct {
Success bool `json:"success"`
Data []byte `json:"data,omitempty"`
Message string `json:"message"`
}