push
This commit is contained in:
		
							parent
							
								
									f731be7b62
								
							
						
					
					
						commit
						fffcc281cc
					
				| 
						 | 
					@ -102,7 +102,7 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CreateWarehouseIntoServiceSupplier ...
 | 
					// CreateWarehouseIntoServiceSupplier ...
 | 
				
			||||||
func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehouseResponse) error {
 | 
					func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWarehousePayload) error {
 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p))
 | 
						msg, err := natsio.GetServer().Request(subject.Warehouse.CreateWarehouseIntoServiceSupplier, toBytes(p))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
| 
						 | 
					@ -118,3 +118,21 @@ func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWareh
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// UpdateWarehouseIntoServiceSupplier ...
 | 
				
			||||||
 | 
					func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWarehousePayload) error {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseIntoServiceSupplier, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var r struct {
 | 
				
			||||||
 | 
							Error string `json:"error"`
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
 | 
							return err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if r.Error != "" {
 | 
				
			||||||
 | 
							return errors.New(r.Error)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,3 +30,11 @@ type CreateSupplierWarehousePayload struct {
 | 
				
			||||||
	DistrictCode int    `json:"districtCode"`
 | 
						DistrictCode int    `json:"districtCode"`
 | 
				
			||||||
	WardCode     int    `json:"wardCode"`
 | 
						WardCode     int    `json:"wardCode"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type UpdateSupplierWarehousePayload struct {
 | 
				
			||||||
 | 
						Supplier     string `json:"supplier"`
 | 
				
			||||||
 | 
						Warehouse    string `json:"warehouse"`
 | 
				
			||||||
 | 
						ProvinceCode int    `json:"provinceCode"`
 | 
				
			||||||
 | 
						DistrictCode int    `json:"districtCode"`
 | 
				
			||||||
 | 
						WardCode     int    `json:"wardCode"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@ var Warehouse = struct {
 | 
				
			||||||
	AfterUpdateWarehouse               string
 | 
						AfterUpdateWarehouse               string
 | 
				
			||||||
	AfterCreateWarehouse               string
 | 
						AfterCreateWarehouse               string
 | 
				
			||||||
	CreateWarehouseIntoServiceSupplier string
 | 
						CreateWarehouseIntoServiceSupplier string
 | 
				
			||||||
 | 
						UpdateWarehouseIntoServiceSupplier string
 | 
				
			||||||
}{
 | 
					}{
 | 
				
			||||||
	AfterCreateWarehouse:               getWarehouseValue("after_create_warehouse"),
 | 
						AfterCreateWarehouse:               getWarehouseValue("after_create_warehouse"),
 | 
				
			||||||
	AfterUpdateWarehouse:               getWarehouseValue("after_update_warehouse"),
 | 
						AfterUpdateWarehouse:               getWarehouseValue("after_update_warehouse"),
 | 
				
			||||||
| 
						 | 
					@ -36,4 +37,5 @@ var Warehouse = struct {
 | 
				
			||||||
	Distinct:                           getWarehouseValue("distinct"),
 | 
						Distinct:                           getWarehouseValue("distinct"),
 | 
				
			||||||
	Count:                              getWarehouseValue("count"),
 | 
						Count:                              getWarehouseValue("count"),
 | 
				
			||||||
	CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
 | 
						CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
 | 
				
			||||||
 | 
						UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue