get list warehouse freeship
This commit is contained in:
		
							parent
							
								
									d71d7f0eb4
								
							
						
					
					
						commit
						b7d963cc90
					
				| 
						 | 
				
			
			@ -3,6 +3,7 @@ package client
 | 
			
		|||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"go.mongodb.org/mongo-driver/bson"
 | 
			
		||||
 | 
			
		||||
	"git.selly.red/Selly-Modules/natsio"
 | 
			
		||||
	"git.selly.red/Selly-Modules/natsio/model"
 | 
			
		||||
| 
						 | 
				
			
			@ -115,3 +116,25 @@ func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWareh
 | 
			
		|||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetWarehouseFreeship ...
 | 
			
		||||
func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusinessType, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Supplier.GetListWarehouseFreeship, toBytes(bson.M{}))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var r struct {
 | 
			
		||||
		Data  *model.ResponseListWarehouseIDByBusinessType `json:"data"`
 | 
			
		||||
		Error string                                       `json:"error"`
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if r.Error != "" {
 | 
			
		||||
		return nil, errors.New(r.Error)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return r.Data, nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,3 +29,7 @@ type SupplierAll struct {
 | 
			
		|||
	Suppliers []SupplierBrief `json:"suppliers"`
 | 
			
		||||
	Total     int64           `json:"total"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ResponseListWarehouseIDByBusinessType struct {
 | 
			
		||||
	Warehouses []string `json:"warehouses"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,8 +10,10 @@ var Supplier = struct {
 | 
			
		|||
	GetListSupplierInfo             string
 | 
			
		||||
	GetSupplierContractBySupplierID string
 | 
			
		||||
	FindAll                         string
 | 
			
		||||
	GetListWarehouseFreeship        string
 | 
			
		||||
}{
 | 
			
		||||
	GetListSupplierInfo:             getSupplierValue("get_list_supplier_info"),
 | 
			
		||||
	GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
 | 
			
		||||
	FindAll:                         getSupplierValue("find_all"),
 | 
			
		||||
	GetListWarehouseFreeship:        getSupplierValue("get_list_warehouse_freeship"),
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue