Merge pull request #29 from Selly-Modules/selly-food

Selly food
This commit is contained in:
trunglt251292 2022-09-22 09:41:47 +07:00 committed by GitHub
commit 4319d2644c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 7 deletions

View File

@ -17,6 +17,24 @@ func GetWarehouse() Warehouse {
return Warehouse{}
}
// UpdateIsClosedSupplier ...
func (w Warehouse) UpdateIsClosedSupplier(p model.UpdateSupplierIsClosedRequest) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateIsClosedSupplier, toBytes(p))
if err != nil {
return err
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return err
}
if r.Error != "" {
return errors.New(r.Error)
}
return nil
}
// AfterCreateWarehouse ...
func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p))

View File

@ -2,8 +2,9 @@ package model
// ResponseSupplierInfo ...
type ResponseSupplierInfo struct {
ID string `json:"id"`
Name string `json:"name"`
ID string `json:"id"`
Name string `json:"name"`
BusinessType string `json:"businessType"`
}
// ResponseSupplierContract ...
@ -16,11 +17,12 @@ type ResponseSupplierContract struct {
// SupplierBrief ...
type SupplierBrief struct {
ID string `json:"_id"`
Name string `json:"name"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
ID string `json:"_id"`
Name string `json:"name"`
Status string `json:"status"`
BusinessType string `json:"businessType"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type SupplierAll struct {

View File

@ -69,3 +69,14 @@ type SyncORStatusRequest struct {
ORCode string `json:"orCode"`
OrderCode string `json:"orderCode"`
}
// UpdateSupplierIsClosedRequest ...
type UpdateSupplierIsClosedRequest struct {
Suppliers []SupplierIsClosed `json:"suppliers"`
}
// SupplierIsClosed ...
type SupplierIsClosed struct {
Supplier string `json:"supplier"`
IsClosed bool `json:"isClosed"`
}

View File

@ -25,6 +25,20 @@ type WarehouseConfiguration struct {
Partner WarehousePartner `json:"partner"`
Delivery WarehouseDelivery `json:"delivery"`
Other WarehouseOther `json:"other"`
Food WarehouseFood `json:"food"`
}
// WarehouseFood ...
type WarehouseFood struct {
ForceClosed bool `json:"forceClosed"`
IsClosed bool `json:"isClosed"`
TimeRange []TimeRange `json:"timeRange"`
}
// TimeRange ...
type TimeRange struct {
From int64 `json:"from"`
To int64 `json:"to"`
}
// WarehouseOther ...
@ -109,6 +123,7 @@ type ResponseLatLng struct {
type WarehouseNatsResponse struct {
ID string `json:"_id"`
Staff string `json:"staff"`
BusinessType string `json:"businessType"`
Name string `json:"name"`
SearchString string `json:"searchString"`
Slug string `json:"slug"`

View File

@ -20,6 +20,7 @@ var Warehouse = struct {
Count string
AfterUpdateWarehouse string
AfterCreateWarehouse string
UpdateIsClosedSupplier string
}{
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
@ -34,4 +35,5 @@ var Warehouse = struct {
FindByCondition: getWarehouseValue("find_all_by_condition"),
Distinct: getWarehouseValue("distinct"),
Count: getWarehouseValue("count"),
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
}