From c6284f32002a058ba7b4bab8c8416e11b7746b79 Mon Sep 17 00:00:00 2001 From: Sinh Date: Mon, 8 Apr 2024 11:40:10 +0700 Subject: [PATCH 1/4] feat(product): add queue OP stock update --- subject/product.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/subject/product.go b/subject/product.go index 39c5a2b..5177fea 100644 --- a/subject/product.go +++ b/subject/product.go @@ -8,15 +8,17 @@ func getProductValue(val string) string { } var Product = struct { - ApplyRequest string - CreateRequestStep string - ProcessApplyRequest string - RequestChangeStatus string - WebhookStockUpdate string + ApplyRequest string + CreateRequestStep string + ProcessApplyRequest string + RequestChangeStatus string + WebhookStockUpdate string // WebhookStockUpdate Kiotviet queue + OPWebhookStockUpdate string // OPWebhookStockUpdate Onpoint queue }{ - ApplyRequest: getProductValue("apply_request"), - CreateRequestStep: getProductValue("create_request_step"), - ProcessApplyRequest: getProductValue("process_apply_request"), - RequestChangeStatus: getProductValue("request_change_status"), - WebhookStockUpdate: getProductValue("webhook_stock_update"), + ApplyRequest: getProductValue("apply_request"), + CreateRequestStep: getProductValue("create_request_step"), + ProcessApplyRequest: getProductValue("process_apply_request"), + RequestChangeStatus: getProductValue("request_change_status"), + WebhookStockUpdate: getProductValue("webhook_stock_update"), + OPWebhookStockUpdate: getProductValue("op_webhook_stock_update"), } -- 2.34.1 From 3a5046f65def47ccea6fc6ea668eaadbfc104a71 Mon Sep 17 00:00:00 2001 From: Sinh Date: Mon, 8 Apr 2024 14:25:18 +0700 Subject: [PATCH 2/4] feat(nats): add warehouse method get list warehouse config --- model/warehouse_request.go | 4 ++++ model/warehouse_response.go | 6 ++++++ subject/warehouse.go | 2 ++ 3 files changed, 12 insertions(+) diff --git a/model/warehouse_request.go b/model/warehouse_request.go index d211345..a573798 100644 --- a/model/warehouse_request.go +++ b/model/warehouse_request.go @@ -130,3 +130,7 @@ type UpdateStatusWarehousePendingInactive struct { WarehouseID string `json:"warehouse"` PendingInactive bool `json:"pendingInactive"` } + +type GetListWarehouseConfigReq struct { + ConfigPartnerCode string `json:"configPartnerCode"` +} diff --git a/model/warehouse_response.go b/model/warehouse_response.go index db81e18..9f11666 100644 --- a/model/warehouse_response.go +++ b/model/warehouse_response.go @@ -181,3 +181,9 @@ type GetWarehousesResponse struct { Limit int64 `json:"limit"` List []WarehouseInfo `json:"list"` } + +type GetListWarehouseConfigRes struct { + Total int64 `json:"total"` + Limit int64 `json:"limit"` + List []WarehouseConfiguration `json:"list"` +} diff --git a/subject/warehouse.go b/subject/warehouse.go index 0d9a218..517a8a1 100644 --- a/subject/warehouse.go +++ b/subject/warehouse.go @@ -32,6 +32,7 @@ var Warehouse = struct { UpdateIsSellyMall string UpdateWarehouseConfig string BulkWriteWarehouseConfig string + GetListWarehouseConfig string }{ CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), @@ -56,4 +57,5 @@ var Warehouse = struct { UpdateIsSellyMall: getWarehouseValue("update_is_selly_mall"), UpdateWarehouseConfig: getWarehouseValue("update_warehouse_config"), BulkWriteWarehouseConfig: getWarehouseValue("bulk_write_warehouse_config"), + GetListWarehouseConfig: getWarehouseValue("get_list_warehouse_config"), } -- 2.34.1 From 90047717047bf3ba900e7cd79011134cc823c823 Mon Sep 17 00:00:00 2001 From: Sinh Date: Mon, 8 Apr 2024 15:40:13 +0700 Subject: [PATCH 3/4] feat(warehouse): add warehouse method get list config --- client/warehouse.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/client/warehouse.go b/client/warehouse.go index 3e4a54d..9993fd7 100644 --- a/client/warehouse.go +++ b/client/warehouse.go @@ -146,6 +146,25 @@ func (w Warehouse) GetConfigByWarehouseID(warehouseID string) (*model.WarehouseC return r.Data, nil } +// GetListConfig ... +func (w Warehouse) GetListConfig(req model.GetListWarehouseConfigReq) ([]*model.WarehouseConfiguration, error) { + msg, err := natsio.GetServer().Request(subject.Warehouse.GetListWarehouseConfig, toBytes(req)) + if err != nil { + return nil, err + } + var r struct { + Data []*model.WarehouseConfiguration `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 +} + // GetWarehouses ... func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWarehousesResponse, error) { msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p)) -- 2.34.1 From fd41b1eadfc3038bcd2eff5beb34c06c2fb98cc0 Mon Sep 17 00:00:00 2001 From: Sinh Date: Tue, 9 Apr 2024 12:07:51 +0700 Subject: [PATCH 4/4] feat(onpoint): update payload --- model/warehouse_request.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/model/warehouse_request.go b/model/warehouse_request.go index 2bec44b..ce61c2b 100644 --- a/model/warehouse_request.go +++ b/model/warehouse_request.go @@ -133,5 +133,6 @@ type UpdateStatusWarehousePendingInactive struct { } type GetListWarehouseConfigReq struct { - ConfigPartnerCode string `json:"configPartnerCode"` + PartnerCode string `json:"partnerCode"` + PartnerIdentityCode string `json:"partnerIdentityCode"` } -- 2.34.1