From 31a13546bb97c94061e8c099e52bf6d3e69bc49d Mon Sep 17 00:00:00 2001 From: kingphon Date: Fri, 22 Sep 2023 15:47:55 +0700 Subject: [PATCH 1/2] Revert "add-migration" This reverts commit f58dfd42910fd18f710d12a601f6ade087342a95. --- client/warehouse.go | 18 ------------------ subject/warehouse.go | 2 -- 2 files changed, 20 deletions(-) diff --git a/client/warehouse.go b/client/warehouse.go index 9c4bbfd..61639bb 100644 --- a/client/warehouse.go +++ b/client/warehouse.go @@ -202,21 +202,3 @@ func (w Warehouse) UpdateStatusWarehousePendingInactive(p model.UpdateStatusWare } return nil } - -// MigrationSellyMall ... -func (w Warehouse) MigrationSellyMall() error { - _, err := natsio.GetServer().Request(subject.Warehouse.MigrationIsSellyMall, toBytes("")) - if err != nil { - return err - } - - var r struct { - Error string `json:"error"` - } - - if r.Error != "" { - return errors.New(r.Error) - } - - return nil -} diff --git a/subject/warehouse.go b/subject/warehouse.go index 34e49c2..4a63cc0 100644 --- a/subject/warehouse.go +++ b/subject/warehouse.go @@ -29,7 +29,6 @@ var Warehouse = struct { GetWarehouses string UpdateORDeliveryStatus string UpdateStatusWarehousePendingInactive string - MigrationIsSellyMall string }{ CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), @@ -51,5 +50,4 @@ var Warehouse = struct { GetWarehouses: getWarehouseValue("get_warehouses"), UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"), UpdateStatusWarehousePendingInactive: getWarehouseValue("update_status_warehouse_pending_inactive"), - MigrationIsSellyMall: getWarehouseValue("migration_is_selly_mall"), } From a62eeb60d201fb92132fae287588da62c2d503a1 Mon Sep 17 00:00:00 2001 From: kingphon Date: Fri, 22 Sep 2023 15:50:06 +0700 Subject: [PATCH 2/2] fix --- client/warehouse.go | 20 ++++++++++++++++++++ model/warehouse_request.go | 5 +++++ subject/warehouse.go | 2 ++ 3 files changed, 27 insertions(+) diff --git a/client/warehouse.go b/client/warehouse.go index 61639bb..3e4a54d 100644 --- a/client/warehouse.go +++ b/client/warehouse.go @@ -202,3 +202,23 @@ func (w Warehouse) UpdateStatusWarehousePendingInactive(p model.UpdateStatusWare } return nil } + +// UpdateIsSellyMall ... +func (w Warehouse) UpdateIsSellyMall(p model.UpdateIsSellyMallRequest) error { + msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateIsSellyMall, toBytes(p)) + if err != nil { + return err + } + + var r struct { + Error string `json:"error"` + } + + if err = json.Unmarshal(msg.Data, &r); err != nil { + return fmt.Errorf("nats: update_is_selly_mall %v", err) + } + if r.Error != "" { + return errors.New(r.Error) + } + return nil +} diff --git a/model/warehouse_request.go b/model/warehouse_request.go index c1dac9c..d211345 100644 --- a/model/warehouse_request.go +++ b/model/warehouse_request.go @@ -120,6 +120,11 @@ type UpdateStatusWarehousePendingInactiveRequest struct { Warehouses []UpdateStatusWarehousePendingInactive `json:"warehouses"` } +// UpdateIsSellyMallRequest ... +type UpdateIsSellyMallRequest struct { + SupplierID string `json:"supplier"` +} + // UpdateStatusWarehousePendingInactive ... type UpdateStatusWarehousePendingInactive struct { WarehouseID string `json:"warehouse"` diff --git a/subject/warehouse.go b/subject/warehouse.go index 4a63cc0..9131f07 100644 --- a/subject/warehouse.go +++ b/subject/warehouse.go @@ -29,6 +29,7 @@ var Warehouse = struct { GetWarehouses string UpdateORDeliveryStatus string UpdateStatusWarehousePendingInactive string + UpdateIsSellyMall string }{ CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"), UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"), @@ -50,4 +51,5 @@ var Warehouse = struct { GetWarehouses: getWarehouseValue("get_warehouses"), UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"), UpdateStatusWarehousePendingInactive: getWarehouseValue("update_status_warehouse_pending_inactive"), + UpdateIsSellyMall: getWarehouseValue("update_is_selly_mall"), }