mirror of
https://github.com/portainer/portainer.git
synced 2025-11-26 14:06:05 +08:00
feat(api): introduce new datastore interface (#3802)
* feat(api): introduce new datastore interface * refactor(api): refactor http and main layers * refactor(api): refactor http and bolt layers
This commit is contained in:
committed by
Anthony Lapenna
parent
493de20540
commit
25103f08f9
@@ -37,7 +37,7 @@ func (handler *Handler) webhookCreate(w http.ResponseWriter, r *http.Request) *h
|
||||
return &httperror.HandlerError{http.StatusBadRequest, "Invalid request payload", err}
|
||||
}
|
||||
|
||||
webhook, err := handler.WebhookService.WebhookByResourceID(payload.ResourceID)
|
||||
webhook, err := handler.DataStore.Webhook().WebhookByResourceID(payload.ResourceID)
|
||||
if err != nil && err != portainer.ErrObjectNotFound {
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "An error occurred retrieving webhooks from the database", err}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func (handler *Handler) webhookCreate(w http.ResponseWriter, r *http.Request) *h
|
||||
WebhookType: portainer.WebhookType(payload.WebhookType),
|
||||
}
|
||||
|
||||
err = handler.WebhookService.CreateWebhook(webhook)
|
||||
err = handler.DataStore.Webhook().CreateWebhook(webhook)
|
||||
if err != nil {
|
||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to persist the webhook inside the database", err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user