get list warehouse freeship #46
|
@ -3,6 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
|
||||||
"git.selly.red/Selly-Modules/natsio"
|
"git.selly.red/Selly-Modules/natsio"
|
||||||
"git.selly.red/Selly-Modules/natsio/model"
|
"git.selly.red/Selly-Modules/natsio/model"
|
||||||
|
@ -115,3 +116,25 @@ func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWareh
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetWarehouseFreeship ...
|
||||||
|
func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusinessType, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Supplier.GetListWarehouseFreeship, toBytes(bson.M{}))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r struct {
|
||||||
|
Data *model.ResponseListWarehouseIDByBusinessType `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
|
||||||
|
}
|
||||||
|
|
|
@ -29,3 +29,7 @@ type SupplierAll struct {
|
||||||
Suppliers []SupplierBrief `json:"suppliers"`
|
Suppliers []SupplierBrief `json:"suppliers"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ResponseListWarehouseIDByBusinessType struct {
|
||||||
|
Warehouses []string `json:"warehouses"`
|
||||||
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ var Supplier = struct {
|
||||||
GetListSupplierInfo string
|
GetListSupplierInfo string
|
||||||
GetSupplierContractBySupplierID string
|
GetSupplierContractBySupplierID string
|
||||||
FindAll string
|
FindAll string
|
||||||
|
GetListWarehouseFreeship string
|
||||||
}{
|
}{
|
||||||
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
|
||||||
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
|
||||||
FindAll: getSupplierValue("find_all"),
|
FindAll: getSupplierValue("find_all"),
|
||||||
|
GetListWarehouseFreeship: getSupplierValue("get_list_warehouse_freeship"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue