[Update] Source

This commit is contained in:
trunglt251292 2022-05-27 14:45:10 +07:00
parent 7dd77f3e31
commit cc8184fe69
3 changed files with 24 additions and 9 deletions

View File

@ -7,4 +7,6 @@ const (
SubjectRequestNatsStaffCreate = "authentication.request.staff.create"
SubjectRequestNatsStaffUpdate = "authentication.request.staff.update"
SubjectRequestNatsAddLogs = "authentication.request.logs.create"
)

View File

@ -28,3 +28,8 @@ func (Request) CreateStaff(payload Staff) (*Response, error) {
func (Request) UpdateStaff(payload Staff) (*Response, error) {
return requestNats(SubjectRequestNatsStaffUpdate, toBytes(payload))
}
// SaveLog ...
func (Request) SaveLog(payload Log) (*Response, error) {
return requestNats(SubjectRequestNatsAddLogs, toBytes(payload))
}

View File

@ -4,6 +4,15 @@ import (
"github.com/Selly-Modules/natsio"
)
// Log ...
type Log struct {
Reference string `json:"reference"`
Payload PayloadCheckPermission `json:"payload"`
Source string `json:"source"`
Permission []string `json:"permission"`
Action string `json:"action"`
}
// Staff ...
type Staff struct {
Reference string `json:"reference"` // ObjectID
@ -13,7 +22,7 @@ type Staff struct {
Active bool `json:"active"`
IsRoot bool `json:"isRoot"`
Permissions []string `json:"permissions"`
Source string `json:"source"`
Source []string `json:"source"`
}
// ListStaff ...
@ -35,7 +44,6 @@ type StaffCheckPermissionBody struct {
Action string `json:"action"`
Source string `json:"source"`
Code string `json:"code,omitempty"`
Payload PayloadCheckPermission `json:"payload"`
IsRoot string `json:"isRoot"`
}