Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ uploads
.env
dist/
.vscode/
.cursor/
12 changes: 12 additions & 0 deletions cmd/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ func initHandlers(g *fastglue.Fastglue, hub *ws.Hub) {
g.PUT("/api/v1/roles/{id}", perm(handleUpdateRole, "roles:manage"))
g.DELETE("/api/v1/roles/{id}", perm(handleDeleteRole, "roles:manage"))

// Integrations.
g.GET("/api/v1/integrations", perm(handleGetIntegrations, "integrations:manage"))
g.GET("/api/v1/integrations/shopify/customer", perm(handleGetShopifyCustomer, "conversations:read"))
g.GET("/api/v1/integrations/shopify/oauth/authorize", perm(handleShopifyOAuthAuthorize, "integrations:manage"))
g.GET("/api/v1/integrations/shopify/oauth/callback", handleShopifyOAuthCallback)
g.GET("/api/v1/integrations/{provider}", perm(handleGetIntegration, "integrations:manage"))
g.POST("/api/v1/integrations", perm(handleCreateIntegration, "integrations:manage"))
g.PUT("/api/v1/integrations/{provider}", perm(handleUpdateIntegration, "integrations:manage"))
g.DELETE("/api/v1/integrations/{provider}", perm(handleDeleteIntegration, "integrations:manage"))
g.PUT("/api/v1/integrations/{provider}/toggle", perm(handleToggleIntegration, "integrations:manage"))
g.POST("/api/v1/integrations/{provider}/test", perm(handleTestIntegration, "integrations:manage"))

// Webhooks.
g.GET("/api/v1/webhooks", perm(handleGetWebhooks, "webhooks:manage"))
g.GET("/api/v1/webhooks/{id}", perm(handleGetWebhook, "webhooks:manage"))
Expand Down
16 changes: 16 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/abhinavxd/libredesk/internal/csat"
customAttribute "github.com/abhinavxd/libredesk/internal/custom_attribute"
"github.com/abhinavxd/libredesk/internal/importer"
"github.com/abhinavxd/libredesk/internal/integration"
"github.com/abhinavxd/libredesk/internal/inbox"
"github.com/abhinavxd/libredesk/internal/inbox/channel/email"
imodels "github.com/abhinavxd/libredesk/internal/inbox/models"
Expand Down Expand Up @@ -942,6 +943,21 @@ func initWebhook(db *sqlx.DB, i18n *i18n.I18n) *webhook.Manager {
return m
}

// initIntegration initializes the integration manager.
func initIntegration(db *sqlx.DB, i18n *i18n.I18n) *integration.Manager {
var lo = initLogger("integration")
m, err := integration.New(integration.Opts{
DB: db,
Lo: lo,
I18n: i18n,
EncryptionKey: ko.MustString("app.encryption_key"),
})
if err != nil {
log.Fatalf("error initializing integration manager: %v", err)
}
return m
}

// initUserNotification inits user notification manager.
func initUserNotification(db *sqlx.DB, i18n *i18n.I18n) *notifier.UserNotificationManager {
var lo = initLogger("user-notification")
Expand Down
Loading
Loading