diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-10 13:13:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 13:13:16 +0800 |
commit | 33fca2b537d36cf998dd27425b2bb8ed5b0965f3 (patch) | |
tree | 817f392502e1c176a5cd7e80290520cb940a8416 /routers/api/v1/org/hook.go | |
parent | edbaa5d3f05b5ca397524587ba9db15edd61bc29 (diff) | |
download | gitea-33fca2b537d36cf998dd27425b2bb8ed5b0965f3.tar.gz gitea-33fca2b537d36cf998dd27425b2bb8ed5b0965f3.zip |
Move webhook into models/webhook/ (#17579)
Diffstat (limited to 'routers/api/v1/org/hook.go')
-rw-r--r-- | routers/api/v1/org/hook.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go index c5982300eb..6c81616170 100644 --- a/routers/api/v1/org/hook.go +++ b/routers/api/v1/org/hook.go @@ -7,7 +7,7 @@ package org import ( "net/http" - "code.gitea.io/gitea/models" + "code.gitea.io/gitea/models/webhook" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/convert" api "code.gitea.io/gitea/modules/structs" @@ -40,18 +40,18 @@ func ListHooks(ctx *context.APIContext) { // "200": // "$ref": "#/responses/HookList" - opts := &models.ListWebhookOptions{ + opts := &webhook.ListWebhookOptions{ ListOptions: utils.GetListOptions(ctx), OrgID: ctx.Org.Organization.ID, } - count, err := models.CountWebhooksByOpts(opts) + count, err := webhook.CountWebhooksByOpts(opts) if err != nil { ctx.InternalServerError(err) return } - orgHooks, err := models.ListWebhooksByOpts(opts) + orgHooks, err := webhook.ListWebhooksByOpts(opts) if err != nil { ctx.InternalServerError(err) return @@ -191,8 +191,8 @@ func DeleteHook(ctx *context.APIContext) { org := ctx.Org.Organization hookID := ctx.ParamsInt64(":id") - if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil { - if models.IsErrWebhookNotExist(err) { + if err := webhook.DeleteWebhookByOrgID(org.ID, hookID); err != nil { + if webhook.IsErrWebhookNotExist(err) { ctx.NotFound() } else { ctx.Error(http.StatusInternalServerError, "DeleteWebhookByOrgID", err) |