refactor-location #134

Closed
trunglam wants to merge 270 commits from refactor-location into master
3 changed files with 29 additions and 0 deletions
Showing only changes of commit 8d20189418 - Show all commits

View File

@ -39,6 +39,28 @@ func (s Supplier) GetListSupplierInfo(p model.GetSupplierRequest) ([]*model.Resp
return r.Data, nil
}
// GetDetailSupplierInfo ...
func (s Supplier) GetDetailSupplierInfo(p model.GetDetailSupplierRequest) (*model.ResponseSupplierInfo, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.GetDetailSupplierInfo, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.ResponseSupplierInfo `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
}
func (s Supplier) GetSupplierContractBySupplierID(p model.GetSupplierContractRequest) (*model.ResponseSupplierContract, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.GetSupplierContractBySupplierID, toBytes(p))
if err != nil {

View File

@ -9,6 +9,11 @@ type GetSupplierRequest struct {
ListID []primitive.ObjectID `json:"listID"`
}
// GetDetailSupplierRequest ...
type GetDetailSupplierRequest struct {
Supplier string `json:"supplier"`
}
type GetSupplierContractRequest struct {
SupplierID primitive.ObjectID `json:"supplierID"`
}

View File

@ -8,6 +8,7 @@ func getSupplierValue(val string) string {
var Supplier = struct {
GetListSupplierInfo string
GetDetailSupplierInfo string
GetSupplierContractBySupplierID string
FindAll string
GetListWarehouseFreeShip string
@ -20,6 +21,7 @@ var Supplier = struct {
Count string
}{
GetListSupplierInfo: getSupplierValue("get_list_supplier_info"),
GetDetailSupplierInfo: getSupplierValue("get_detail_supplier_info"),
GetSupplierContractBySupplierID: getSupplierValue("get_supplier_contract_by_supplier_id"),
FindAll: getSupplierValue("find_all"),
GetListWarehouseFreeShip: getSupplierValue("get_list_warehouse_free_ship"),