Compare commits
	
		
			No commits in common. "5edec97ee393a4f0bc8d851da42f856d082ff7aa" and "2ba590a0a04d73354f27c162d7d3b3151a61a09f" have entirely different histories.
		
	
	
		
			5edec97ee3
			...
			2ba590a0a0
		
	
		| 
						 | 
					@ -3,7 +3,6 @@ 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"
 | 
				
			||||||
| 
						 | 
					@ -84,39 +83,3 @@ 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
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// BulkWriteWarehouseConfig ...
 | 
					 | 
				
			||||||
func (w Warehouse) BulkWriteWarehouseConfig(p model.UpdatePayload) error {
 | 
					 | 
				
			||||||
	msg, err := natsio.GetServer().Request(subject.Warehouse.BulkWriteWarehouseConfig, 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
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,14 +43,3 @@ 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"`
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
type WebhookPayloadV2 struct {
 | 
					 | 
				
			||||||
	Path string `json:"path"` // request URL path from external
 | 
					 | 
				
			||||||
	Data string `json:"data"` // request body
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,9 +5,6 @@ type CommunicationRequestHttp struct {
 | 
				
			||||||
	ResponseImmediately bool        `json:"responseImmediately"`
 | 
						ResponseImmediately bool        `json:"responseImmediately"`
 | 
				
			||||||
	Authentication      string      `json:"authentication"`
 | 
						Authentication      string      `json:"authentication"`
 | 
				
			||||||
	Payload             HttpRequest `json:"payload"`
 | 
						Payload             HttpRequest `json:"payload"`
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// collection to store log data, will be prepended with log-, default it stored in logs collections
 | 
					 | 
				
			||||||
	LogTarget string `json:"logTarget"`
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HttpRequest ...
 | 
					// HttpRequest ...
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,11 +12,9 @@ var Product = struct {
 | 
				
			||||||
	CreateRequestStep   string
 | 
						CreateRequestStep   string
 | 
				
			||||||
	ProcessApplyRequest string
 | 
						ProcessApplyRequest string
 | 
				
			||||||
	RequestChangeStatus string
 | 
						RequestChangeStatus string
 | 
				
			||||||
	WebhookStockUpdate  string
 | 
					 | 
				
			||||||
}{
 | 
					}{
 | 
				
			||||||
	ApplyRequest:        getProductValue("apply_request"),
 | 
						ApplyRequest:        getProductValue("apply_request"),
 | 
				
			||||||
	CreateRequestStep:   getProductValue("create_request_step"),
 | 
						CreateRequestStep:   getProductValue("create_request_step"),
 | 
				
			||||||
	ProcessApplyRequest: getProductValue("process_apply_request"),
 | 
						ProcessApplyRequest: getProductValue("process_apply_request"),
 | 
				
			||||||
	RequestChangeStatus: getProductValue("request_change_status"),
 | 
						RequestChangeStatus: getProductValue("request_change_status"),
 | 
				
			||||||
	WebhookStockUpdate:  getProductValue("webhook_stock_update"),
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,8 +30,6 @@ var Warehouse = struct {
 | 
				
			||||||
	UpdateORDeliveryStatus               string
 | 
						UpdateORDeliveryStatus               string
 | 
				
			||||||
	UpdateStatusWarehousePendingInactive string
 | 
						UpdateStatusWarehousePendingInactive string
 | 
				
			||||||
	UpdateIsSellyMall                    string
 | 
						UpdateIsSellyMall                    string
 | 
				
			||||||
	UpdateWarehouseConfig                string
 | 
					 | 
				
			||||||
	BulkWriteWarehouseConfig             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"),
 | 
				
			||||||
| 
						 | 
					@ -54,6 +52,4 @@ 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"),
 | 
					 | 
				
			||||||
	BulkWriteWarehouseConfig:             getWarehouseValue("bulk_write_warehouse_config"),
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue