[Update] Get staff info
This commit is contained in:
		
							parent
							
								
									33b40fe8da
								
							
						
					
					
						commit
						94fa0d0231
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ...
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 ...
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue