Update permission #4

Merged
trunglt251292 merged 8 commits from update-permission into master 2022-07-01 02:26:53 +00:00
3 changed files with 16 additions and 4 deletions
Showing only changes of commit 94fa0d0231 - Show all commits

View File

@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/Selly-Modules/natsio" "github.com/Selly-Modules/natsio"
"go.mongodb.org/mongo-driver/bson"
) )
// Client ... // Client ...
@ -69,3 +70,9 @@ func toBytes(data interface{}) []byte {
b, _ := json.Marshal(data) b, _ := json.Marshal(data)
return b return b
} }
// bsonToBytes ...
func bsonToBytes(data interface{}) []byte {
b, _ := bson.Marshal(data)
return b
}

View File

@ -31,12 +31,12 @@ func (Request) UpdateStaff(payload Staff) (*Response, error) {
// GetInfoStaff ... // GetInfoStaff ...
func (Request) GetInfoStaff(payload GetInfoStaff) (*Response, error) { func (Request) GetInfoStaff(payload GetInfoStaff) (*Response, error) {
return requestNats(SubjectRequestNatsStaffGetInfo, toBytes(payload)) return requestNats(SubjectRequestNatsStaffGetInfo, bsonToBytes(payload))
} }
// GetListStaff ... // GetListStaff ...
func (Request) GetListStaff(payload GetInfoStaff) (*Response, error) { func (Request) GetListStaff(payload GetInfoStaff) (*Response, error) {
return requestNats(SubjectRequestNatsStaffGetList, toBytes(payload)) return requestNats(SubjectRequestNatsStaffGetList, bsonToBytes(payload))
} }
// SaveLog ... // SaveLog ...

View File

@ -24,9 +24,14 @@ type GetTokenByPhoneResponse struct {
Token string `json:"token"` Token string `json:"token"`
} }
// GetInfoStaff ... // GetInfoStaff
// Convert to bson bytes
// When partner use. Bson unmarshal convert to struct
type GetInfoStaff struct { type GetInfoStaff struct {
Condition interface{} `json:"condition"` Condition interface{}
Page int
Limit int
Sort bson.D
} }
// Log ... // Log ...