fix conflix

This commit is contained in:
buiphuan0211 2022-12-23 14:52:00 +07:00
commit c336e034f8
7 changed files with 61 additions and 147 deletions

View File

@ -274,3 +274,23 @@ func (s Supplier) DeleteCashflow(p model.SupplierDeleteCashflowReq) error {
} }
return nil return nil
} }
// CheckTokenSupplier ...
func (s Supplier) CheckTokenSupplier(p model.CheckTokenSupplierPayload) (*model.ResponseSupplierInfo, error) {
msg, err := natsio.GetServer().Request(subject.Supplier.CheckTokenSupplier, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Error string `json:"error"`
Data *model.ResponseSupplierInfo `json:"data"`
}
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
}

View File

@ -182,66 +182,3 @@ func (w Warehouse) UpdateORDeliveryStatus(p model.WarehouseORUpdateDeliveryStatu
} }
return nil return nil
} }
// CreateSupplierHoliday ...
func (w Warehouse) CreateSupplierHoliday(p model.SupplierHolidayCreatePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.CreateSupplierHoliday, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return fmt.Errorf("nats: create_supplier_holiday %v", err)
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
// UpdateSupplierHoliday ...
func (w Warehouse) UpdateSupplierHoliday(p model.SupplierHolidayUpdatePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateSupplierHoliday, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return fmt.Errorf("nats: create_supplier_holiday %v", err)
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
// GetSupplierHoliday ...
func (w Warehouse) GetSupplierHoliday(p model.GetSupplierHolidayRequest) (*model.ResponseSupplierHoliday, error) {
msg, err := natsio.GetServer().Request(subject.Warehouse.GetSupplierHoliday, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.ResponseSupplierHoliday `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
}

View File

@ -62,3 +62,8 @@ type SupplierCountReq struct {
IDs []string `json:"ids"` IDs []string `json:"ids"`
Status string `json:"status"` // active,inactive Status string `json:"status"` // active,inactive
} }
// CheckTokenSupplierPayload ...
type CheckTokenSupplierPayload struct {
Token string `json:"token"`
}

View File

@ -113,30 +113,3 @@ type WarehouseORUpdateDeliveryStatus struct {
OrderID string `json:"orderId"` OrderID string `json:"orderId"`
DeliveryStatus string `json:"deliveryStatus"` DeliveryStatus string `json:"deliveryStatus"`
} }
// SupplierHolidayCreatePayload ...
type SupplierHolidayCreatePayload struct {
Supplier string `json:"supplier"`
Title string `json:"title"`
From string `json:"from"`
To string `json:"to"`
Warehouses []string `json:"warehouses"`
IsApplyAll bool `json:"isApplyAll"`
Source string `json:"source"`
}
// SupplierHolidayUpdatePayload ...
type SupplierHolidayUpdatePayload struct {
Supplier string `json:"supplier"`
Title string `json:"title"`
From string `json:"from"`
To string `json:"to"`
Warehouses []string `json:"warehouses"`
IsApplyAll bool `json:"isApplyAll"`
Source string `json:"source"`
}
// GetSupplierHolidayRequest ...
type GetSupplierHolidayRequest struct {
Conditions interface{} `json:"conditions"`
}

View File

@ -173,20 +173,3 @@ type GetWarehousesResponse struct {
Limit int64 `json:"limit"` Limit int64 `json:"limit"`
List []WarehouseInfo `json:"list"` List []WarehouseInfo `json:"list"`
} }
// ResponseWarehouseShort ...
type ResponseWarehouseShort struct {
ID string `json:"_id"`
Name string `json:"name"`
}
// ResponseSupplierHoliday ...
type ResponseSupplierHoliday struct {
Title string `json:"title"`
From string `json:"from"`
To string `json:"to"`
Status string `json:"status"`
Reason string `json:"reason"`
IsApplyAll bool `json:"isApplyAll"`
Warehouses []ResponseWarehouseShort `json:"warehouses"`
}

View File

@ -18,6 +18,7 @@ var Supplier = struct {
GetFreeShipInfo string GetFreeShipInfo string
FindAllOld string FindAllOld string
Count string Count string
CheckTokenSupplier 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"),
@ -30,4 +31,5 @@ var Supplier = struct {
GetFreeShipInfo: getSupplierValue("get_free_ship_info"), GetFreeShipInfo: getSupplierValue("get_free_ship_info"),
FindAllOld: getSupplierValue("find_all_old"), FindAllOld: getSupplierValue("find_all_old"),
Count: getSupplierValue("count"), Count: getSupplierValue("count"),
CheckTokenSupplier: getSupplierValue("check_token_supplier"),
} }

View File

@ -10,50 +10,44 @@ var Warehouse = struct {
SyncWarehouseIntoServiceSupplier string SyncWarehouseIntoServiceSupplier string
CreateWarehouseIntoServiceSupplier string CreateWarehouseIntoServiceSupplier string
UpdateWarehouseIntoServiceSupplier string UpdateWarehouseIntoServiceSupplier string
CreateOutboundRequest string CreateOutboundRequest string
UpdateOutboundRequestLogistic string UpdateOutboundRequestLogistic string
CancelOutboundRequest string CancelOutboundRequest string
GetConfiguration string GetConfiguration string
SyncORStatus string SyncORStatus string
WebhookTNC string WebhookTNC string
WebhookShiip string WebhookShiip string
WebhookGlobalCare string WebhookGlobalCare string
WebhookOnPoint string WebhookOnPoint string
FindOne string FindOne string
FindByCondition string FindByCondition string
Distinct string Distinct string
Count string Count string
AfterUpdateWarehouse string AfterUpdateWarehouse string
AfterCreateWarehouse string AfterCreateWarehouse string
UpdateIsClosedSupplier string UpdateIsClosedSupplier string
GetWarehouses string GetWarehouses string
UpdateORDeliveryStatus string UpdateORDeliveryStatus string
CreateSupplierHoliday string
UpdateSupplierHoliday string
GetSupplierHoliday string
}{ }{
SyncWarehouseIntoServiceSupplier: getWarehouseValue("sync_warehouse_into_service_supplier"), SyncWarehouseIntoServiceSupplier: getWarehouseValue("sync_warehouse_into_service_supplier"),
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"), AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"), AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
CreateOutboundRequest: getWarehouseValue("create_outbound_request"), CreateOutboundRequest: getWarehouseValue("create_outbound_request"),
UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"), UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"),
CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"), CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"),
GetConfiguration: getWarehouseValue("get_configuration"), GetConfiguration: getWarehouseValue("get_configuration"),
SyncORStatus: getWarehouseValue("sync_or_status"), SyncORStatus: getWarehouseValue("sync_or_status"),
WebhookTNC: getWarehouseValue("webhook_tnc"), WebhookTNC: getWarehouseValue("webhook_tnc"),
WebhookShiip: getWarehouseValue("webhook_shiip"), WebhookShiip: getWarehouseValue("webhook_shiip"),
WebhookGlobalCare: getWarehouseValue("webhook_global_care"), WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
WebhookOnPoint: getWarehouseValue("webhook_on_point"), WebhookOnPoint: getWarehouseValue("webhook_on_point"),
FindOne: getWarehouseValue("find_one"), FindOne: getWarehouseValue("find_one"),
FindByCondition: getWarehouseValue("find_all_by_condition"), FindByCondition: getWarehouseValue("find_all_by_condition"),
Distinct: getWarehouseValue("distinct"), Distinct: getWarehouseValue("distinct"),
Count: getWarehouseValue("count"), Count: getWarehouseValue("count"),
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"), UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
GetWarehouses: getWarehouseValue("get_warehouses"), GetWarehouses: getWarehouseValue("get_warehouses"),
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"), UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
CreateSupplierHoliday: getWarehouseValue("create_supplier_holiday"),
UpdateSupplierHoliday: getWarehouseValue("update_supplier_holiday"),
GetSupplierHoliday: getWarehouseValue("get_supplier_holiday"),
} }