V1 #1

Merged
trunglt251292 merged 13 commits from v1 into master 2022-05-31 03:35:14 +00:00
3 changed files with 30 additions and 1 deletions
Showing only changes of commit 2bbb1aec3f - Show all commits

View File

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

View File

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

View File

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