V14: Webhook Management API (#15147)
* Add webhook to management api * Update webhook controllers * Add ByKey webhook controller * Fix typo * Fix typo * Update multiple webhooks * Update using * Remove duplicate constant after merge * Fix typo in file name * Update casing of IWebhookService * Fix typo * Use Webhook entity type * Fix ambiguous reference * Update webhook mapping * Update after change of CreatedAtAction * Use CreatedAtId instead * Update src/Umbraco.Cms.Api.Management/Controllers/Webhook/ByKeyWebhookController.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.Api.Management/Controllers/Webhook/ByKeyWebhookController.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.Api.Management/ViewModels/Webhook/CreateWebhookRequestModel.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.Api.Management/Controllers/Webhook/DeleteWebhookController.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Update src/Umbraco.Cms.Api.Management/Controllers/Webhook/CreateWebhookController.cs Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> * Add Guid to WebhookResponseModel * Cleanup * Add Auth * Move webhook logic from backoffice to management api * Add mapping --------- Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0f6705795a
commit
f47830b165
@@ -1,4 +1,4 @@
|
||||
using NPoco;
|
||||
using NPoco;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Persistence.Repositories;
|
||||
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
|
||||
@@ -58,6 +58,24 @@ public class WebhookRepository : IWebhookRepository
|
||||
return webhookDto is null ? null : await DtoToEntity(webhookDto);
|
||||
}
|
||||
|
||||
public async Task<PagedModel<IWebhook>> GetByIdsAsync(IEnumerable<Guid> keys)
|
||||
{
|
||||
Sql<ISqlContext>? sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql()
|
||||
.SelectAll()
|
||||
.From<WebhookDto>()
|
||||
.InnerJoin<Webhook2EventsDto>()
|
||||
.On<WebhookDto, Webhook2EventsDto>(left => left.Id, right => right.WebhookId)
|
||||
.WhereIn<Webhook2EventsDto>(x => x.WebhookId, keys);
|
||||
|
||||
List<WebhookDto>? webhookDtos = await _scopeAccessor.AmbientScope?.Database.FetchAsync<WebhookDto>(sql)!;
|
||||
|
||||
return new PagedModel<IWebhook>
|
||||
{
|
||||
Items = await DtosToEntities(webhookDtos),
|
||||
Total = webhookDtos.Count,
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PagedModel<IWebhook>> GetByAliasAsync(string alias)
|
||||
{
|
||||
Sql<ISqlContext>? sql = _scopeAccessor.AmbientScope?.Database.SqlContext.Sql()
|
||||
|
||||
Reference in New Issue
Block a user