|
|
|
@@ -731,17 +731,17 @@ func registerV1Routes(g *gin.RouterGroup, h *Handlers) {
|
|
|
|
|
// Chatwoot: GET /api/v1/accounts/:account_id/agents (index)
|
|
|
|
|
accounts.GET("/:account_id/agents", h.Agent.List)
|
|
|
|
|
// Chatwoot: POST /api/v1/accounts/:account_id/agents (create)
|
|
|
|
|
accounts.POST("/:account_id/agents", middleware.RoleCheck("administrator"), h.Agent.Create)
|
|
|
|
|
accounts.POST("/:account_id/agents", middleware.SuperAdminOrAdministrator(), h.Agent.Create)
|
|
|
|
|
// Chatwoot: PATCH/PUT /api/v1/accounts/:account_id/agents/:id (update)
|
|
|
|
|
accounts.PATCH("/:account_id/agents/:agent_id", middleware.RoleCheck("administrator"), h.Agent.Update)
|
|
|
|
|
accounts.PUT("/:account_id/agents/:agent_id", middleware.RoleCheck("administrator"), h.Agent.Update)
|
|
|
|
|
accounts.PATCH("/:account_id/agents/:agent_id", middleware.SuperAdminOrAdministrator(), h.Agent.Update)
|
|
|
|
|
accounts.PUT("/:account_id/agents/:agent_id", middleware.SuperAdminOrAdministrator(), h.Agent.Update)
|
|
|
|
|
// Chatwoot: DELETE /api/v1/accounts/:account_id/agents/:id (destroy)
|
|
|
|
|
accounts.DELETE("/:account_id/agents/:agent_id", middleware.RoleCheck("administrator"), h.Agent.Delete)
|
|
|
|
|
accounts.POST("/:account_id/agents/:agent_id/reset_password", middleware.RoleCheck("administrator"), h.Agent.ResetPassword)
|
|
|
|
|
accounts.DELETE("/:account_id/agents/:agent_id", middleware.SuperAdminOrAdministrator(), h.Agent.Delete)
|
|
|
|
|
accounts.POST("/:account_id/agents/:agent_id/reset_password", middleware.SuperAdminOrAdministrator(), h.Agent.ResetPassword)
|
|
|
|
|
// Chatwoot: GET /api/v1/accounts/:account_id/agents/:id (show) — was missing
|
|
|
|
|
accounts.GET("/:account_id/agents/:agent_id", h.Agent.Get)
|
|
|
|
|
// Chatwoot: POST /api/v1/accounts/:account_id/agents/bulk_create
|
|
|
|
|
accounts.POST("/:account_id/agents/bulk_create", middleware.RoleCheck("administrator"), h.Agent.BulkCreate)
|
|
|
|
|
accounts.POST("/:account_id/agents/bulk_create", middleware.SuperAdminOrAdministrator(), h.Agent.BulkCreate)
|
|
|
|
|
// Bulk assign/unassign conversations to agents (ref: Chatwoot agents_controller.rb #bulk_assign, #bulk_unassign)
|
|
|
|
|
accounts.POST("/:account_id/agents/bulk_assign", h.AgentBulk.BulkAssign)
|
|
|
|
|
accounts.POST("/:account_id/agents/bulk_unassign", h.AgentBulk.BulkUnassign)
|
|
|
|
|