[Update] Get staff info

This commit is contained in:
trunglt251292 2022-07-01 09:20:57 +07:00
parent 33b40fe8da
commit 94fa0d0231
3 changed files with 16 additions and 4 deletions

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