chore: stabilize chatwoot parity baseline
This commit is contained in:
@@ -69,7 +69,7 @@ func (h *BotTriggerConfigHandler) ListByBot(c *gin.Context) {
|
||||
// Get retrieves a single trigger config by ID.
|
||||
// GET /api/v1/accounts/:account_id/agent_bots/:agent_bot_id/trigger_configs/:id
|
||||
func (h *BotTriggerConfigHandler) Get(c *gin.Context) {
|
||||
id, err := parseUintParam(c, "id")
|
||||
id, err := parseUintAnyParam(c, "trigger_config_id", "id", "agent_bot_id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid id")
|
||||
return
|
||||
@@ -99,12 +99,12 @@ func (h *BotTriggerConfigHandler) Create(c *gin.Context) {
|
||||
}
|
||||
|
||||
var req struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
EventName automation.BotRuleEventType `json:"event_name" binding:"required"`
|
||||
Conditions automation.TriggerConditions `json:"conditions"`
|
||||
QueryOperator string `json:"query_operator"`
|
||||
Active bool `json:"active"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
EventName automation.BotRuleEventType `json:"event_name" binding:"required"`
|
||||
Conditions automation.TriggerConditions `json:"conditions"`
|
||||
QueryOperator string `json:"query_operator"`
|
||||
Active bool `json:"active"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
@@ -143,7 +143,7 @@ func (h *BotTriggerConfigHandler) Create(c *gin.Context) {
|
||||
// Update updates an existing trigger config.
|
||||
// PUT /api/v1/accounts/:account_id/agent_bots/:agent_bot_id/trigger_configs/:id
|
||||
func (h *BotTriggerConfigHandler) Update(c *gin.Context) {
|
||||
id, err := parseUintParam(c, "id")
|
||||
id, err := parseUintAnyParam(c, "trigger_config_id", "id", "agent_bot_id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid id")
|
||||
return
|
||||
@@ -156,12 +156,12 @@ func (h *BotTriggerConfigHandler) Update(c *gin.Context) {
|
||||
}
|
||||
|
||||
var req struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
EventName automation.BotRuleEventType `json:"event_name"`
|
||||
Conditions automation.TriggerConditions `json:"conditions"`
|
||||
QueryOperator string `json:"query_operator"`
|
||||
Active bool `json:"active"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
EventName automation.BotRuleEventType `json:"event_name"`
|
||||
Conditions automation.TriggerConditions `json:"conditions"`
|
||||
QueryOperator string `json:"query_operator"`
|
||||
Active bool `json:"active"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrValidation, err.Error())
|
||||
@@ -197,7 +197,7 @@ func (h *BotTriggerConfigHandler) Update(c *gin.Context) {
|
||||
// Delete soft-deletes a trigger config.
|
||||
// DELETE /api/v1/accounts/:account_id/agent_bots/:agent_bot_id/trigger_configs/:id
|
||||
func (h *BotTriggerConfigHandler) Delete(c *gin.Context) {
|
||||
id, err := parseUintParam(c, "id")
|
||||
id, err := parseUintAnyParam(c, "trigger_config_id", "id", "agent_bot_id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid id")
|
||||
return
|
||||
@@ -214,7 +214,7 @@ func (h *BotTriggerConfigHandler) Delete(c *gin.Context) {
|
||||
// ToggleActive toggles the active state of a trigger config.
|
||||
// PATCH /api/v1/accounts/:account_id/agent_bots/:agent_bot_id/trigger_configs/:id/active
|
||||
func (h *BotTriggerConfigHandler) ToggleActive(c *gin.Context) {
|
||||
id, err := parseUintParam(c, "id")
|
||||
id, err := parseUintAnyParam(c, "trigger_config_id", "id", "agent_bot_id")
|
||||
if err != nil {
|
||||
response.AbortWithStatusError(c, http.StatusBadRequest, response.ErrBadRequest, "invalid id")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user