feature/update-warehouse-into-supplier #44
|
@ -102,7 +102,7 @@ func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*mod
|
|||
}
|
||||
|
||||
// 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))
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -118,3 +118,21 @@ func (s Supplier) CreateWarehouseIntoServiceSupplier(p model.CreateSupplierWareh
|
|||
}
|
||||
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"`
|
||||
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
|
||||
AfterCreateWarehouse string
|
||||
CreateWarehouseIntoServiceSupplier string
|
||||
UpdateWarehouseIntoServiceSupplier string
|
||||
}{
|
||||
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
||||
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
||||
|
@ -36,4 +37,5 @@ var Warehouse = struct {
|
|||
Distinct: getWarehouseValue("distinct"),
|
||||
Count: getWarehouseValue("count"),
|
||||
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
||||
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue