diff --git a/constants.go b/constants.go index f3c95f9..17ee75b 100644 --- a/constants.go +++ b/constants.go @@ -3,4 +3,5 @@ package authentication const ( SubjectRequestNatsCheckPermission = "authentication.request.staff.check_permission" SubjectRequestNatsGetPermission = "authentication.request.staff.list_permission" + SubjectRequestNatsSyncStaff = "authentication.request.staff.sync_data" ) diff --git a/request.go b/request.go index 88426ed..dc67886 100644 --- a/request.go +++ b/request.go @@ -13,3 +13,8 @@ func (Request) CheckPermission(payload StaffCheckPermissionBody) (*Response, err func (Request) GetPermission(payload StaffGetPermissions) (*Response, error) { return requestNats(SubjectRequestNatsGetPermission, toBytes(payload)) } + +// SyncData ... +func (Request) SyncData(payload ListStaff) (*Response, error) { + return requestNats(SubjectRequestNatsSyncStaff, toBytes(payload)) +} diff --git a/struct.go b/struct.go index 83ed60e..22fd526 100644 --- a/struct.go +++ b/struct.go @@ -1,6 +1,29 @@ 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 type Config struct {