Przeglądaj źródła

update schema and add webhook event handler

Ivan Galakhov 4 lat temu
rodzic
commit
d07b5541e8

+ 1 - 1
internal/models/integrations/github_app.go

@@ -8,7 +8,7 @@ type GithubAppInstallation struct {
 	gorm.Model
 
 	// Can belong to either a user or an organization
-	AccountID string `json:"account_id"`
+	AccountID string `json:"account_id" gorm:"unique"`
 
 	// Installation ID (used for authentication)
 	InstallationID string `json:"installation_id"`

+ 4 - 0
server/api/integration_handler.go

@@ -377,3 +377,7 @@ func (app *App) HandleListProjectOAuthIntegrations(w http.ResponseWriter, r *htt
 		return
 	}
 }
+
+func (app *App) HandleGithubAppEvent(w http.ResponseWriter, r *http.Request) {
+
+}

+ 6 - 0
server/router/router.go

@@ -176,6 +176,12 @@ func New(a *api.App) *chi.Mux {
 				),
 			)
 
+			r.Method(
+				"GET",
+				"/integrations/github-app/webhook",
+				requestlog.NewHandler(a.HandleGithubAppEvent, l),
+			)
+
 			// /api/templates routes
 			r.Method(
 				"GET",