mergeDev/campaign #73

Closed
Ghost wants to merge 208 commits from mergeDev/campaign into develop
5 changed files with 14 additions and 26 deletions
Showing only changes of commit 0dafeb6f1f - Show all commits

View File

@ -119,7 +119,7 @@ func (s Supplier) UpdateWarehouseIntoServiceSupplier(p model.UpdateSupplierWareh
// GetWarehouseFreeship ... // GetWarehouseFreeship ...
func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusinessType, error) { func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusinessType, error) {
msg, err := natsio.GetServer().Request(subject.Selly.GetListWarehouseFreeship, toBytes(bson.M{})) msg, err := natsio.GetServer().Request(subject.Supplier.GetListWarehouseFreeship, toBytes(bson.M{}))
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -139,15 +139,15 @@ func (s Supplier) GetWarehouseFreeship() (*model.ResponseListWarehouseIDByBusine
return r.Data, nil return r.Data, nil
} }
// GetFreeshipsBySupplierIDs ... // GetFreeShipInfo ...
func (s Supplier) GetFreeshipsBySupplierIDs(p model.GetFreeshipsBySupplierIds) (*model.ResponseListFreeshipsBySupplierIds, error) { func (s Supplier) GetFreeShipInfo(p []model.SupplierFreeShipInfoRequestPayload) ([]*model.SupplierFreeShipInfoResponse, error) {
msg, err := natsio.GetServer().Request(subject.Selly.GetFreeshipsBySupplierIds, toBytes(p)) msg, err := natsio.GetServer().Request(subject.Supplier.GetFreeShipInfo, toBytes(p))
if err != nil { if err != nil {
return nil, err return nil, err
} }
var r struct { var r struct {
Data *model.ResponseListFreeshipsBySupplierIds `json:"data"` Data []*model.SupplierFreeShipInfoResponse `json:"data"`
Error string `json:"error"` Error string `json:"error"`
} }
if err = json.Unmarshal(msg.Data, &r); err != nil { if err = json.Unmarshal(msg.Data, &r); err != nil {
return nil, err return nil, err

View File

@ -49,6 +49,6 @@ type SupplierCashflowCreatePayload struct {
ClickAction *ClickAction `json:"clickAction"` ClickAction *ClickAction `json:"clickAction"`
} }
type GetFreeshipsBySupplierIds struct { type SupplierFreeShipInfoRequestPayload struct {
SupplierIDs []string `json:"supplierIds"` SupplierID string `json:"supplierId"`
} }

View File

@ -38,13 +38,14 @@ type SupplierCashflowCreateResponse struct {
ID string `json:"id"` ID string `json:"id"`
} }
type Freeship struct { type FreeShip struct {
ID string `json:"_id"` ID string `json:"_id"`
ShortName string `json:"shortName"` ShortName string `json:"shortName"`
MilestoneText []string `json:"milestoneText"` MilestoneText []string `json:"milestoneText"`
Order int `json:"-"`
} }
type ResponseListFreeshipsBySupplierIds struct { type SupplierFreeShipInfoResponse struct {
SupplierID string `json:"supplierId"` SupplierID string `json:"supplierId"`
Freeships []Freeship `json:"freeships"` FreeShips []FreeShip `json:"freeShips"`
} }

View File

@ -1,15 +0,0 @@
package subject
import "fmt"
func getSellyValue(val string) string {
return fmt.Sprintf("%s.%s", prefixes.Selly, val)
}
var Selly = struct {
GetFreeshipsBySupplierIds string
GetListWarehouseFreeship string
}{
GetFreeshipsBySupplierIds: getSellyValue("get_freeships_by_supplier_ids"),
GetListWarehouseFreeship: getSupplierValue("get_list_warehouse_freeship"),
}

View File

@ -12,10 +12,12 @@ var Supplier = struct {
FindAll string FindAll string
GetListWarehouseFreeship string GetListWarehouseFreeship string
CreateCashflow string CreateCashflow string
GetFreeShipInfo 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"), GetListWarehouseFreeship: getSupplierValue("get_list_warehouse_freeship"),
CreateCashflow: getSupplierValue("create_cashflow"), CreateCashflow: getSupplierValue("create_cashflow"),
GetFreeShipInfo: getSupplierValue("get_free_ship_info"),
} }