onpoint-stock-update #166

Merged
sinhluu merged 5 commits from onpoint-stock-update into master 2024-05-08 07:18:03 +00:00
1 changed files with 19 additions and 0 deletions
Showing only changes of commit 9004771704 - Show all commits

View File

@ -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))