kiotviet #161

Merged
sinhluu merged 5 commits from kiotviet into master 2023-10-20 09:08:41 +00:00
3 changed files with 27 additions and 0 deletions
Showing only changes of commit 28178e0c31 - Show all commits

View File

@ -3,6 +3,7 @@ package client
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"git.selly.red/Selly-Modules/natsio" "git.selly.red/Selly-Modules/natsio"
"git.selly.red/Selly-Modules/natsio/model" "git.selly.red/Selly-Modules/natsio/model"
"git.selly.red/Selly-Modules/natsio/subject" "git.selly.red/Selly-Modules/natsio/subject"
@ -83,3 +84,21 @@ func (w Warehouse) FindByCondition(p model.FindWithCondition) ([]*model.Warehous
} }
return r.Data, nil return r.Data, nil
} }
// UpdateWarehouseConfig ...
func (w Warehouse) UpdateWarehouseConfig(p model.UpdatePayload) error {
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateWarehouseConfig, bsonToBytes(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
}

View File

@ -43,3 +43,9 @@ type RequestCondition struct {
Page int64 `json:"page"` Page int64 `json:"page"`
Limit int64 `json:"limit"` Limit int64 `json:"limit"`
} }
type UpdatePayload struct {
Conditions interface{} `json:"conditions"`
Payload interface{} `json:"payload"`
Opts []*options.UpdateOptions `json:"opts"`
}

View File

@ -30,6 +30,7 @@ var Warehouse = struct {
UpdateORDeliveryStatus string UpdateORDeliveryStatus string
UpdateStatusWarehousePendingInactive string UpdateStatusWarehousePendingInactive string
UpdateIsSellyMall string UpdateIsSellyMall string
UpdateWarehouseConfig string
}{ }{
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"),
@ -52,4 +53,5 @@ var Warehouse = struct {
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"), UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
UpdateStatusWarehousePendingInactive: getWarehouseValue("update_status_warehouse_pending_inactive"), UpdateStatusWarehousePendingInactive: getWarehouseValue("update_status_warehouse_pending_inactive"),
UpdateIsSellyMall: getWarehouseValue("update_is_selly_mall"), UpdateIsSellyMall: getWarehouseValue("update_is_selly_mall"),
UpdateWarehouseConfig: getWarehouseValue("update_warehouse_config"),
} }