Merge branch 'admin-push-notification-supplier' into develop

This commit is contained in:
Sinh 2022-11-18 10:14:21 +07:00
commit 23df6da6bf
3 changed files with 30 additions and 0 deletions

View File

@ -81,6 +81,27 @@ func (s Supplier) FindAll(supplierID model.SupplierRequestPayload) (*model.Suppl
return r.Data, nil return r.Data, nil
} }
func (s Supplier) FindAllOld(req model.SupplierFindAllReq) (*model.SupplierAll, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.FindAllOld, toBytes(req))
if err != nil {
return nil, err
}
var r struct {
Data *model.SupplierAll `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) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) { func (s Supplier) GetBankInfoByID(supplierID model.SupplierRequestPayload) (*model.SupplierAll, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID)) msg, err := natsio.GetServer().Request(subject.Supplier.FindAll, toBytes(supplierID))
if err != nil { if err != nil {

View File

@ -48,3 +48,10 @@ type SupplierGetCurrentBalanceReq struct {
type SupplierDeleteCashflowReq struct { type SupplierDeleteCashflowReq struct {
CashflowID string `json:"cashflowId"` CashflowID string `json:"cashflowId"`
} }
type SupplierFindAllReq struct {
Page int64 `json:"page"`
Limit int64 `json:"limit"`
Segment string `json:"segment"`
IDs []string `json:"ids"`
}

View File

@ -16,6 +16,7 @@ var Supplier = struct {
UpdateBalance string UpdateBalance string
GetCurrentBalance string GetCurrentBalance string
GetFreeShipInfo string GetFreeShipInfo string
FindAllOld 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"),
@ -26,4 +27,5 @@ var Supplier = struct {
UpdateBalance: getSupplierValue("update_balance"), UpdateBalance: getSupplierValue("update_balance"),
GetCurrentBalance: getSupplierValue("get_current_balance"), GetCurrentBalance: getSupplierValue("get_current_balance"),
GetFreeShipInfo: getSupplierValue("get_free_ship_info"), GetFreeShipInfo: getSupplierValue("get_free_ship_info"),
FindAllOld: getSupplierValue("find_all_old"),
} }