Compare commits

...

6 Commits

Author SHA1 Message Date
Sinh Luu d80090cfb5
Merge pull request #39 from Selly-Modules/global-care-car-insurance
Global care car insurance
2022-10-04 11:44:31 +07:00
Sinh 9ba66dae05 Merge branch 'master' of github.com:Selly-Modules/natsio into global-care-car-insurance 2022-10-04 11:38:47 +07:00
trunglt251292 89f4e1a11d
Merge pull request #38 from Selly-Modules/feature/seller-by-id
Feature/seller by
2022-10-03 10:48:13 +07:00
Sinh Luu 99f75cfbc7
Merge pull request #37 from Selly-Modules/export-warehouse-data
define warehouse method
2022-09-30 18:12:03 +07:00
Sinh aab1103fc8 define warehouse method 2022-09-30 10:32:33 +07:00
Sinh 57d6cb18a9 update global care - integrate car insurance 2022-09-28 08:59:18 +07:00
4 changed files with 66 additions and 0 deletions

View File

@ -144,3 +144,22 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC
}
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
}

View File

@ -17,6 +17,7 @@ type OutboundRequestPayload struct {
// InsuranceOpts ...
type InsuranceOpts struct {
InsuranceType string `json:"insuranceType"`
VehicleTypeID string `json:"vehicleTypeId"`
VehicleTypeName string `json:"vehicleTypeName"`
InsuranceTypeID string `json:"insuranceTypeId"`
@ -25,6 +26,12 @@ type InsuranceOpts struct {
Chassis string `json:"chassis"`
Engine string `json:"engine"`
BeginDate string `json:"beginDate"`
// For car insurance
NumberOfSeatsCarOccupantAccidentInsurance int `json:"numberOfSeatsCarOccupantAccidentInsurance"`
NumberOfSeats int `json:"numberOfSeats"`
NumberOfSeatsOrTonnageId string `json:"numberOfSeatsOrTonnageId"`
NumberOfSeatsOrTonnageName string `json:"numberOfSeatsOrTonnageName"`
}
// OutboundRequestItem ...
@ -80,3 +87,14 @@ type SupplierIsClosed struct {
Supplier string `json:"supplier"`
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"`
}

View File

@ -135,3 +135,30 @@ type WarehouseNatsResponse struct {
CreatedAt time.Time `json:"createdAt"`
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"`
}

View File

@ -21,6 +21,7 @@ var Warehouse = struct {
AfterUpdateWarehouse string
AfterCreateWarehouse string
UpdateIsClosedSupplier string
GetWarehouses string
}{
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
@ -36,4 +37,5 @@ var Warehouse = struct {
Distinct: getWarehouseValue("distinct"),
Count: getWarehouseValue("count"),
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
GetWarehouses: getWarehouseValue("get_warehouses"),
}