Compare commits
6 Commits
feature/se
...
master
Author | SHA1 | Date |
---|---|---|
Sinh Luu | d80090cfb5 | |
Sinh | 9ba66dae05 | |
trunglt251292 | 89f4e1a11d | |
Sinh Luu | 99f75cfbc7 | |
Sinh | aab1103fc8 | |
Sinh | 57d6cb18a9 |
|
@ -144,3 +144,22 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC
|
||||||
}
|
}
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetWarehouses ...
|
||||||
|
func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWarehousesResponse, error) {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Data *model.GetWarehousesResponse `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
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ type OutboundRequestPayload struct {
|
||||||
|
|
||||||
// InsuranceOpts ...
|
// InsuranceOpts ...
|
||||||
type InsuranceOpts struct {
|
type InsuranceOpts struct {
|
||||||
|
InsuranceType string `json:"insuranceType"`
|
||||||
VehicleTypeID string `json:"vehicleTypeId"`
|
VehicleTypeID string `json:"vehicleTypeId"`
|
||||||
VehicleTypeName string `json:"vehicleTypeName"`
|
VehicleTypeName string `json:"vehicleTypeName"`
|
||||||
InsuranceTypeID string `json:"insuranceTypeId"`
|
InsuranceTypeID string `json:"insuranceTypeId"`
|
||||||
|
@ -25,6 +26,12 @@ type InsuranceOpts struct {
|
||||||
Chassis string `json:"chassis"`
|
Chassis string `json:"chassis"`
|
||||||
Engine string `json:"engine"`
|
Engine string `json:"engine"`
|
||||||
BeginDate string `json:"beginDate"`
|
BeginDate string `json:"beginDate"`
|
||||||
|
|
||||||
|
// For car insurance
|
||||||
|
NumberOfSeatsCarOccupantAccidentInsurance int `json:"numberOfSeatsCarOccupantAccidentInsurance"`
|
||||||
|
NumberOfSeats int `json:"numberOfSeats"`
|
||||||
|
NumberOfSeatsOrTonnageId string `json:"numberOfSeatsOrTonnageId"`
|
||||||
|
NumberOfSeatsOrTonnageName string `json:"numberOfSeatsOrTonnageName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// OutboundRequestItem ...
|
// OutboundRequestItem ...
|
||||||
|
@ -80,3 +87,14 @@ type SupplierIsClosed struct {
|
||||||
Supplier string `json:"supplier"`
|
Supplier string `json:"supplier"`
|
||||||
IsClosed bool `json:"isClosed"`
|
IsClosed bool `json:"isClosed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetWarehousesRequest ...
|
||||||
|
type GetWarehousesRequest struct {
|
||||||
|
Keyword string `json:"keyword"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
|
|
||||||
|
Page int64 `json:"page"`
|
||||||
|
Limit int64 `json:"limit"`
|
||||||
|
}
|
||||||
|
|
|
@ -135,3 +135,30 @@ type WarehouseNatsResponse struct {
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WarehouseInfo ...
|
||||||
|
type WarehouseInfo struct {
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
Slug string `json:"slug"`
|
||||||
|
Supplier WarehouseSupplierInfo `json:"supplier"`
|
||||||
|
Location ResponseWarehouseLocation `json:"location"`
|
||||||
|
Contact ResponseWarehouseContact `json:"contact"`
|
||||||
|
CreatedAt string `json:"createdAt"`
|
||||||
|
UpdatedAt string `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WarehouseSupplierInfo ...
|
||||||
|
type WarehouseSupplierInfo struct {
|
||||||
|
ID string `json:"_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetWarehousesResponse ...
|
||||||
|
type GetWarehousesResponse struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
Limit int64 `json:"limit"`
|
||||||
|
List []WarehouseInfo `json:"list"`
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ var Warehouse = struct {
|
||||||
AfterUpdateWarehouse string
|
AfterUpdateWarehouse string
|
||||||
AfterCreateWarehouse string
|
AfterCreateWarehouse string
|
||||||
UpdateIsClosedSupplier string
|
UpdateIsClosedSupplier string
|
||||||
|
GetWarehouses string
|
||||||
}{
|
}{
|
||||||
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
||||||
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
||||||
|
@ -36,4 +37,5 @@ var Warehouse = struct {
|
||||||
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"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue