diff --git a/authentication.go b/authentication.go index 4e747f5..0992675 100644 --- a/authentication.go +++ b/authentication.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "github.com/Selly-Modules/natsio" + "go.mongodb.org/mongo-driver/bson" ) // Client ... @@ -69,3 +70,9 @@ func toBytes(data interface{}) []byte { b, _ := json.Marshal(data) return b } + +// bsonToBytes ... +func bsonToBytes(data interface{}) []byte { + b, _ := bson.Marshal(data) + return b +} diff --git a/request.go b/request.go index e3e88b3..325255c 100644 --- a/request.go +++ b/request.go @@ -31,12 +31,12 @@ func (Request) UpdateStaff(payload Staff) (*Response, error) { // GetInfoStaff ... func (Request) GetInfoStaff(payload GetInfoStaff) (*Response, error) { - return requestNats(SubjectRequestNatsStaffGetInfo, toBytes(payload)) + return requestNats(SubjectRequestNatsStaffGetInfo, bsonToBytes(payload)) } // GetListStaff ... func (Request) GetListStaff(payload GetInfoStaff) (*Response, error) { - return requestNats(SubjectRequestNatsStaffGetList, toBytes(payload)) + return requestNats(SubjectRequestNatsStaffGetList, bsonToBytes(payload)) } // SaveLog ... diff --git a/struct.go b/struct.go index 4968145..4359444 100644 --- a/struct.go +++ b/struct.go @@ -24,9 +24,14 @@ type GetTokenByPhoneResponse struct { Token string `json:"token"` } -// GetInfoStaff ... +// GetInfoStaff +// Convert to bson bytes +// When partner use. Bson unmarshal convert to struct type GetInfoStaff struct { - Condition interface{} `json:"condition"` + Condition interface{} + Page int + Limit int + Sort bson.D } // Log ...