aboutsummaryrefslogtreecommitdiff
path: root/models/webhook.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 0b7b3a99..5acc83f5 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -45,6 +45,7 @@ type Webhook struct {
IsActive bool
HookTaskType HookTaskType
Meta string `xorm:"TEXT"` // store hook-specific attributes
+ OrgId int64
}
// GetEvent handles conversion from Events to HookEvent.
@@ -120,6 +121,18 @@ func DeleteWebhook(hookId int64) error {
return err
}
+// GetWebhooksByOrgId returns all webhooks for an organization.
+func GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId})
+ return ws, err
+}
+
+// GetActiveWebhooksByOrgId returns all active webhooks for an organization.
+func GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error) {
+ err = x.Find(&ws, &Webhook{OrgId: orgId, IsActive: true})
+ return ws, err
+}
+
// ___ ___ __ ___________ __
// / | \ ____ ____ | | _\__ ___/____ _____| | __
// / ~ \/ _ \ / _ \| |/ / | | \__ \ / ___/ |/ /