mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 15:02:43 +00:00
Move webhook into models/webhook/ (#17579)
This commit is contained in:
parent
edbaa5d3f0
commit
33fca2b537
47 changed files with 770 additions and 717 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue