V1 #1
|
@ -7,4 +7,6 @@ const (
|
||||||
|
|
||||||
SubjectRequestNatsStaffCreate = "authentication.request.staff.create"
|
SubjectRequestNatsStaffCreate = "authentication.request.staff.create"
|
||||||
SubjectRequestNatsStaffUpdate = "authentication.request.staff.update"
|
SubjectRequestNatsStaffUpdate = "authentication.request.staff.update"
|
||||||
|
|
||||||
|
SubjectRequestNatsAddLogs = "authentication.request.logs.create"
|
||||||
)
|
)
|
||||||
|
|
|
@ -28,3 +28,8 @@ func (Request) CreateStaff(payload Staff) (*Response, error) {
|
||||||
func (Request) UpdateStaff(payload Staff) (*Response, error) {
|
func (Request) UpdateStaff(payload Staff) (*Response, error) {
|
||||||
return requestNats(SubjectRequestNatsStaffUpdate, toBytes(payload))
|
return requestNats(SubjectRequestNatsStaffUpdate, toBytes(payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveLog ...
|
||||||
|
func (Request) SaveLog(payload Log) (*Response, error) {
|
||||||
|
return requestNats(SubjectRequestNatsAddLogs, toBytes(payload))
|
||||||
|
}
|
||||||
|
|
26
struct.go
26
struct.go
|
@ -4,6 +4,15 @@ import (
|
||||||
"github.com/Selly-Modules/natsio"
|
"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 ...
|
// Staff ...
|
||||||
type Staff struct {
|
type Staff struct {
|
||||||
Reference string `json:"reference"` // ObjectID
|
Reference string `json:"reference"` // ObjectID
|
||||||
|
@ -13,7 +22,7 @@ type Staff struct {
|
||||||
Active bool `json:"active"`
|
Active bool `json:"active"`
|
||||||
IsRoot bool `json:"isRoot"`
|
IsRoot bool `json:"isRoot"`
|
||||||
Permissions []string `json:"permissions"`
|
Permissions []string `json:"permissions"`
|
||||||
Source string `json:"source"`
|
Source []string `json:"source"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListStaff ...
|
// ListStaff ...
|
||||||
|
@ -29,14 +38,13 @@ type Config struct {
|
||||||
|
|
||||||
// StaffCheckPermissionBody ...
|
// StaffCheckPermissionBody ...
|
||||||
type StaffCheckPermissionBody struct {
|
type StaffCheckPermissionBody struct {
|
||||||
StaffID string `json:"staffId"`
|
StaffID string `json:"staffId"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Permission []string `json:"permission"`
|
Permission []string `json:"permission"`
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
Code string `json:"code,omitempty"`
|
Code string `json:"code,omitempty"`
|
||||||
Payload PayloadCheckPermission `json:"payload"`
|
IsRoot string `json:"isRoot"`
|
||||||
IsRoot string `json:"isRoot"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PayloadCheckPermission ...
|
// PayloadCheckPermission ...
|
||||||
|
|
Loading…
Reference in New Issue