setup-holiday-supplier-tool #123
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -38,6 +38,28 @@ func (s Supplier) GetListSupplierInfo(p model.GetSupplierRequest) ([]*model.Resp
 | 
			
		|||
	return r.Data, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetDetailSupplierInfo ...
 | 
			
		||||
func (s Supplier) GetDetailSupplierInfo(p model.GetDetailSupplierRequest) (*model.ResponseSupplierInfo, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Supplier.GetDetailSupplierInfo, toBytes(p))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var r struct {
 | 
			
		||||
		Data  *model.ResponseSupplierInfo `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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s Supplier) GetSupplierContractBySupplierID(p model.GetSupplierContractRequest) (*model.ResponseSupplierContract, error) {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierContractBySupplierID, toBytes(p))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,11 @@ type GetSupplierRequest struct {
 | 
			
		|||
	ListID []primitive.ObjectID `json:"listID"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetDetailSupplierRequest ...
 | 
			
		||||
type GetDetailSupplierRequest struct {
 | 
			
		||||
	Supplier string `json:"supplier"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type GetSupplierContractRequest struct {
 | 
			
		||||
	SupplierID primitive.ObjectID `json:"supplierID"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,12 +8,14 @@ func getSupplierValue(val string) string {
 | 
			
		|||
 | 
			
		||||
var Supplier = struct {
 | 
			
		||||
	GetListSupplierInfo             string
 | 
			
		||||
	GetDetailSupplierInfo           string
 | 
			
		||||
	GetSupplierContractBySupplierID string
 | 
			
		||||
	FindAll                         string
 | 
			
		||||
	FindAllOld                      string
 | 
			
		||||
	Count                           string
 | 
			
		||||
}{
 | 
			
		||||
	GetListSupplierInfo:             getSupplierValue("get_list_supplier_info"),
 | 
			
		||||
	GetDetailSupplierInfo:           getSupplierValue("get_detail_supplier_info"),
 | 
			
		||||
	GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
 | 
			
		||||
	FindAll:                         getSupplierValue("find_all"),
 | 
			
		||||
	FindAllOld:                      getSupplierValue("find_all_old"),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue