Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

Add hook for org creation

David Weiricha971fd8dcb3a
diff --git a/app/server/handlers/orgs.go b/app/server/handlers/orgs.go
index 6bba3515..1c0e1fa4 100644
--- a/app/server/handlers/orgs.go
+++ b/app/server/handlers/orgs.go
@@ -6,6 +6,7 @@ import (
"log"
"net/http"
"plandex-server/db"
+ "plandex-server/hooks"
"plandex-server/types"
"github.com/plandex/plandex/shared"
@@ -127,6 +128,15 @@ func CreateOrgHandler(w http.ResponseWriter, r *http.Request) {
}
}
+ err = hooks.ExecHook(hooks.CreateOrg, hooks.HookParams{
+ W: w,
+ User: auth.User,
+ Org: org,
+ })
+ if err != nil {
+ return
+ }
+
err = tx.Commit()
if err != nil {
diff --git a/app/server/hooks/hooks.go b/app/server/hooks/hooks.go
index 74a6098b..59636383 100644
--- a/app/server/hooks/hooks.go
+++ b/app/server/hooks/hooks.go
@@ -12,12 +12,15 @@ const (
WillCreatePlan = "will_create_plan"
WillTellPlan = "will_tell_plan"
WillExecPlan = "will_exec_plan"
+
+ CreateOrg = "create_org"
)
type HookParams struct {
W http.ResponseWriter
User *db.User
OrgId string
+ Org *db.Org
Plan *db.Plan
StreamDoneCh chan *shared.ApiError
}