onpoint-stock-update #166
|
@ -146,6 +146,25 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC
|
|||
return r.Data, nil
|
||||
}
|
||||
|
||||
// GetListConfig ...
|
||||
func (w Warehouse) GetListConfig(req model.GetListWarehouseConfigReq) ([]*model.WarehouseConfiguration, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.GetListWarehouseConfig, toBytes(req))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var r struct {
|
||||
Data []*model.WarehouseConfiguration `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
|
||||
}
|
||||
|
||||
// GetWarehouses ...
|
||||
func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWarehousesResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p))
|
||||
|
|
Loading…
Reference in New Issue