diff --git a/constants.go b/constants.go index 17ee75b..df612b2 100644 --- a/constants.go +++ b/constants.go @@ -4,4 +4,5 @@ const ( SubjectRequestNatsCheckPermission = "authentication.request.staff.check_permission" SubjectRequestNatsGetPermission = "authentication.request.staff.list_permission" SubjectRequestNatsSyncStaff = "authentication.request.staff.sync_data" + SubjectRequestNatsSyncRole = "authentication.request.role.sync_data" ) diff --git a/request.go b/request.go index dc67886..0dc0589 100644 --- a/request.go +++ b/request.go @@ -18,3 +18,8 @@ func (Request) GetPermission(payload StaffGetPermissions) (*Response, error) { func (Request) SyncData(payload ListStaff) (*Response, error) { return requestNats(SubjectRequestNatsSyncStaff, toBytes(payload)) } + +// SyncRoleData ... +func (Request) SyncRoleData(payload ListRole) (*Response, error) { + return requestNats(SubjectRequestNatsSyncRole, toBytes(payload)) +} diff --git a/struct.go b/struct.go index 22fd526..71bf10f 100644 --- a/struct.go +++ b/struct.go @@ -4,6 +4,20 @@ import ( "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 ... type Staff struct { ID string `json:"_id"` // ObjectID