[Update] add request sync roles

This commit is contained in:
trunglt251292 2022-05-24 14:31:45 +07:00
parent 2bbb1aec3f
commit 29bdeb7d40
3 changed files with 20 additions and 0 deletions

View File

@ -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"
)

View File

@ -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))
}

View File

@ -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