[Update] add request sync roles
This commit is contained in:
parent
2bbb1aec3f
commit
29bdeb7d40
|
@ -4,4 +4,5 @@ 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"
|
SubjectRequestNatsSyncStaff = "authentication.request.staff.sync_data"
|
||||||
|
SubjectRequestNatsSyncRole = "authentication.request.role.sync_data"
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,3 +18,8 @@ func (Request) GetPermission(payload StaffGetPermissions) (*Response, error) {
|
||||||
func (Request) SyncData(payload ListStaff) (*Response, error) {
|
func (Request) SyncData(payload ListStaff) (*Response, error) {
|
||||||
return requestNats(SubjectRequestNatsSyncStaff, toBytes(payload))
|
return requestNats(SubjectRequestNatsSyncStaff, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncRoleData ...
|
||||||
|
func (Request) SyncRoleData(payload ListRole) (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestNatsSyncRole, toBytes(payload))
|
||||||
|
}
|
||||||
|
|
14
struct.go
14
struct.go
|
@ -4,6 +4,20 @@ import (
|
||||||
"github.com/Selly-Modules/natsio"
|
"github.com/Selly-Modules/natsio"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
}
|
||||||
|
|
||||||
// Staff ...
|
// Staff ...
|
||||||
type Staff struct {
|
type Staff struct {
|
||||||
ID string `json:"_id"` // ObjectID
|
ID string `json:"_id"` // ObjectID
|
||||||
|
|
Loading…
Reference in New Issue