[Update] add request sync staff
This commit is contained in:
parent
8ff62dc55a
commit
2bbb1aec3f
|
@ -3,4 +3,5 @@ package authentication
|
||||||
const (
|
const (
|
||||||
SubjectRequestNatsCheckPermission = "authentication.request.staff.check_permission"
|
SubjectRequestNatsCheckPermission = "authentication.request.staff.check_permission"
|
||||||
SubjectRequestNatsGetPermission = "authentication.request.staff.list_permission"
|
SubjectRequestNatsGetPermission = "authentication.request.staff.list_permission"
|
||||||
|
SubjectRequestNatsSyncStaff = "authentication.request.staff.sync_data"
|
||||||
)
|
)
|
||||||
|
|
|
@ -13,3 +13,8 @@ func (Request) CheckPermission(payload StaffCheckPermissionBody) (*Response, err
|
||||||
func (Request) GetPermission(payload StaffGetPermissions) (*Response, error) {
|
func (Request) GetPermission(payload StaffGetPermissions) (*Response, error) {
|
||||||
return requestNats(SubjectRequestNatsGetPermission, toBytes(payload))
|
return requestNats(SubjectRequestNatsGetPermission, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncData ...
|
||||||
|
func (Request) SyncData(payload ListStaff) (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestNatsSyncStaff, toBytes(payload))
|
||||||
|
}
|
||||||
|
|
25
struct.go
25
struct.go
|
@ -1,6 +1,29 @@
|
||||||
package authentication
|
package authentication
|
||||||
|
|
||||||
import "github.com/Selly-Modules/natsio"
|
import (
|
||||||
|
"github.com/Selly-Modules/natsio"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
}
|
||||||
|
|
||||||
// Config int client elasticsearch
|
// Config int client elasticsearch
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
Loading…
Reference in New Issue