From d53e34cd6a307c1d0afb75a351a719ec063781ed Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 28 Mar 2022 08:57:58 +0800 Subject: [PATCH] feat: added send attempts api --- ...sManagementPermissionDefinitionProvider.cs | 11 +++ .../WebhooksManagementPermissions.cs | 6 ++ .../IWebhooksSendRecordAppService.cs | 15 ++++ ....cs => IWebhooksSubscriptionAppService.cs} | 2 +- .../WebhookEventRecordDto.cs | 12 +++ .../WebhookSendRecordDto.cs | 24 ++++++ .../WebhookSendRecordGetListInput.cs | 20 +++++ ...hooksManagementApplicationMapperProfile.cs | 2 + .../WebhooksSendRecordAppService.cs | 74 +++++++++++++++++++ ...e.cs => WebhooksSubscriptionAppService.cs} | 4 +- .../Localization/Resources/en.json | 7 ++ .../Localization/Resources/zh-Hans.json | 7 ++ .../EfCoreWebhookSendRecordRepository.cs | 5 ++ .../WebhooksSendRecordController.cs | 44 +++++++++++ ...r.cs => WebhooksSubscriptionController.cs} | 6 +- 15 files changed, 233 insertions(+), 6 deletions(-) create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSendRecordAppService.cs rename aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/{IWebhookSubscriptionAppService.cs => IWebhooksSubscriptionAppService.cs} (86%) create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookEventRecordDto.cs create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDto.cs create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordGetListInput.cs create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordAppService.cs rename aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/{WebhookSubscriptionAppService.cs => WebhooksSubscriptionAppService.cs} (94%) create mode 100644 aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordController.cs rename aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/{WebhookSubscriptionController.cs => WebhooksSubscriptionController.cs} (84%) diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs index 3af3d870a..7d15875c3 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissionDefinitionProvider.cs @@ -32,6 +32,17 @@ public class WebhooksManagementPermissionDefinitionProvider : PermissionDefiniti MultiTenancySides.Host) .WithProviders(ClientPermissionValueProvider.ProviderName); + var sendAttempts = group.AddPermission( + WebhooksManagementPermissions.WebhooksSendAttempts.Default, + L("Permission:SendAttempts"), + MultiTenancySides.Host) + .WithProviders(ClientPermissionValueProvider.ProviderName); + sendAttempts.AddChild( + WebhooksManagementPermissions.WebhooksSendAttempts.Resend, + L("Permission:Resend"), + MultiTenancySides.Host) + .WithProviders(ClientPermissionValueProvider.ProviderName); + group.AddPermission( WebhooksManagementPermissions.Publish, L("Permission:Publish")) diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs index bdabbfa8c..6f6ab9c47 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/Authorization/WebhooksManagementPermissions.cs @@ -18,4 +18,10 @@ public static class WebhooksManagementPermissions public const string Update = Default + ".Update"; public const string Delete = Default + ".Delete"; } + + public static class WebhooksSendAttempts + { + public const string Default = GroupName + ".SendAttempts"; + public const string Resend = Default + ".Resend"; + } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSendRecordAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSendRecordAppService.cs new file mode 100644 index 000000000..18e20cee5 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSendRecordAppService.cs @@ -0,0 +1,15 @@ +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.WebhooksManagement; + +public interface IWebhooksSendRecordAppService : IApplicationService +{ + Task GetAsync(Guid id); + + Task ResendAsync(Guid id); + + Task> GetListAsync(WebhookSendRecordGetListInput input); +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSubscriptionAppService.cs similarity index 86% rename from aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs rename to aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSubscriptionAppService.cs index f250b6418..af7f63163 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhookSubscriptionAppService.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/IWebhooksSubscriptionAppService.cs @@ -5,7 +5,7 @@ using Volo.Abp.Application.Services; namespace LINGYUN.Abp.WebhooksManagement; -public interface IWebhookSubscriptionAppService : +public interface IWebhooksSubscriptionAppService : ICrudAppService< WebhookSubscriptionDto, Guid, diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookEventRecordDto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookEventRecordDto.cs new file mode 100644 index 000000000..a282777a6 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookEventRecordDto.cs @@ -0,0 +1,12 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.WebhooksManagement; + +public class WebhookEventRecordDto : EntityDto +{ + public Guid? TenantId { get; set; } + public string WebhookName { get; set; } + public string Data { get; set; } + public DateTime CreationTime { get; set; } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDto.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDto.cs new file mode 100644 index 000000000..9c0dcd85e --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordDto.cs @@ -0,0 +1,24 @@ +using System; +using System.Net; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.WebhooksManagement; + +public class WebhookSendRecordDto : EntityDto +{ + public Guid? TenantId { get; set; } + + public Guid WebhookEventId { get; set; } + + public Guid WebhookSubscriptionId { get; set; } + + public string Response { get; set; } + + public HttpStatusCode? ResponseStatusCode { get; set; } + + public DateTime CreationTime { get; set; } + + public DateTime? LastModificationTime { get; set; } + + public WebhookEventRecordDto WebhookEvent { get; set; } = new WebhookEventRecordDto(); +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordGetListInput.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordGetListInput.cs new file mode 100644 index 000000000..018cec849 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application.Contracts/LINGYUN/Abp/WebhooksManagement/WebhookSendRecordGetListInput.cs @@ -0,0 +1,20 @@ +using System; +using System.Net; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.WebhooksManagement; + +public class WebhookSendRecordGetListInput : PagedAndSortedResultRequestDto +{ + public string Filter { get; set; } + + public Guid? WebhookEventId { get; set; } + + public Guid? SubscriptionId { get; set; } + + public HttpStatusCode? ResponseStatusCode { get; set; } + + public DateTime? BeginCreationTime { get; set; } + + public DateTime? EndCreationTime { get; set; } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs index dd3323fec..11ab195a0 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs @@ -6,5 +6,7 @@ public class WebhooksManagementApplicationMapperProfile : Profile { public WebhooksManagementApplicationMapperProfile() { + CreateMap(); + CreateMap(); } } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordAppService.cs new file mode 100644 index 000000000..7e29b2e4f --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordAppService.cs @@ -0,0 +1,74 @@ +using LINGYUN.Abp.Webhooks; +using LINGYUN.Abp.WebhooksManagement.Authorization; +using LINGYUN.Abp.WebhooksManagement.Extensions; +using Microsoft.AspNetCore.Authorization; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.BackgroundJobs; + +namespace LINGYUN.Abp.WebhooksManagement; + +[Authorize(WebhooksManagementPermissions.WebhooksSendAttempts.Default)] +public class WebhooksSendRecordAppService : WebhooksManagementAppServiceBase, IWebhooksSendRecordAppService +{ + protected IBackgroundJobManager BackgroundJobManager => LazyServiceProvider.LazyGetRequiredService(); + protected IWebhookEventRecordRepository EventRepository => LazyServiceProvider.LazyGetRequiredService(); + protected IWebhookSubscriptionRepository SubscriptionRepository => LazyServiceProvider.LazyGetRequiredService(); + + + protected IWebhookSendRecordRepository RecordRepository { get; } + + public WebhooksSendRecordAppService( + IWebhookSendRecordRepository recordRepository) + { + RecordRepository = recordRepository; + } + + public async virtual Task GetAsync(Guid id) + { + var sendRecord = await RecordRepository.GetAsync(id); + + return ObjectMapper.Map(sendRecord); + } + + public async virtual Task> GetListAsync(WebhookSendRecordGetListInput input) + { + var filter = new WebhookSendRecordFilter + { + SubscriptionId = input.SubscriptionId, + ResponseStatusCode = input.ResponseStatusCode, + BeginCreationTime = input.BeginCreationTime, + EndCreationTime = input.EndCreationTime, + WebhookEventId = input.WebhookEventId, + Filter = input.Filter + }; + var totalCount = await RecordRepository.GetCountAsync(filter); + var sendRecords = await RecordRepository.GetListAsync(filter, + input.Sorting, input.MaxResultCount, input.SkipCount); + + return new PagedResultDto(totalCount, + ObjectMapper.Map, List>(sendRecords)); + } + + [Authorize(WebhooksManagementPermissions.WebhooksSendAttempts.Resend)] + public async virtual Task ResendAsync(Guid id) + { + var sendRecord = await RecordRepository.GetAsync(id); + var sendEvent = await EventRepository.GetAsync(sendRecord.WebhookEventId); + var subscription = await SubscriptionRepository.GetAsync(sendRecord.WebhookSubscriptionId); + + await BackgroundJobManager.EnqueueAsync(new WebhookSenderArgs + { + TenantId = CurrentTenant.Id, + WebhookSubscriptionId = sendRecord.WebhookSubscriptionId, + WebhookEventId = sendRecord.WebhookEventId, + WebhookName = sendEvent.WebhookName, + WebhookUri = subscription.WebhookUri, + Data = sendEvent.Data, + Headers = subscription.GetWebhookHeaders(), + Secret = subscription.Secret, + }); + } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionAppService.cs similarity index 94% rename from aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs rename to aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionAppService.cs index 6502b4725..17420474e 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionAppService.cs @@ -13,12 +13,12 @@ using Volo.Abp.Application.Dtos; namespace LINGYUN.Abp.WebhooksManagement; [Authorize(WebhooksManagementPermissions.WebhookSubscription.Default)] -public class WebhookSubscriptionAppService : WebhooksManagementAppServiceBase, IWebhookSubscriptionAppService +public class WebhooksSubscriptionAppService : WebhooksManagementAppServiceBase, IWebhooksSubscriptionAppService { protected IWebhookDefinitionManager WebhookDefinitionManager { get; } protected IWebhookSubscriptionRepository SubscriptionRepository { get; } - public WebhookSubscriptionAppService( + public WebhooksSubscriptionAppService( IWebhookDefinitionManager webhookDefinitionManager, IWebhookSubscriptionRepository subscriptionRepository) { diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json index 10f87c775..b3828f603 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/en.json @@ -3,6 +3,13 @@ "texts": { "Features:WebhooksManagement": "Webhooks", "Permission:WebhooksManagement": "Webhooks", + "Permission:Subscriptions": "Subscriptions", + "Permission:SendAttempts": "Attempts", + "Permission:Create": "Create", + "Permission:Update": "Update", + "Permission:Delete": "Delete", + "Permission:Resend": "Resend", + "Permission:Publish": "Publish", "Permission:ManageSettings": "Manage Settings", "DisplayName:CheckConnect": "Check Connect", "Description:CheckConnect": "When a third-party service is connected, it is used to check whether the communication is normal.", diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json index 0e89e364a..d20d0efdd 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain.Shared/LINGYUN/Abp/WebhooksManagement/Localization/Resources/zh-Hans.json @@ -3,6 +3,13 @@ "texts": { "Features:WebhooksManagement": "Webhooks", "Permission:WebhooksManagement": "Webhooks", + "Permission:Subscriptions": "管理订阅", + "Permission:SendAttempts": "管理发送", + "Permission:Create": "创建", + "Permission:Update": "编辑", + "Permission:Delete": "删除", + "Permission:Resend": "重新发送", + "Permission:Publish": "发布事件", "Permission:ManageSettings": "管理设置", "DisplayName:CheckConnect": "检查连接", "Description:CheckConnect": "第三方服务接入时,用于检查是否通讯正常.", diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSendRecordRepository.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSendRecordRepository.cs index f7ba0d433..9f1270348 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSendRecordRepository.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookSendRecordRepository.cs @@ -43,6 +43,11 @@ public class EfCoreWebhookSendRecordRepository : .ToListAsync(GetCancellationToken(cancellationToken)); } + public async override Task> WithDetailsAsync() + { + return (await base.WithDetailsAsync()).IncludeDetails(); + } + protected virtual IQueryable ApplyFilter( IQueryable queryable, WebhookSendRecordFilter filter) diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordController.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordController.cs new file mode 100644 index 000000000..f775527c0 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSendRecordController.cs @@ -0,0 +1,44 @@ +using LINGYUN.Abp.WebhooksManagement.Authorization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.WebhooksManagement; + +[RemoteService(Name = WebhooksManagementRemoteServiceConsts.RemoteServiceName)] +[Area(WebhooksManagementRemoteServiceConsts.ModuleName)] +[Authorize(WebhooksManagementPermissions.WebhooksSendAttempts.Default)] +[Route("api/webhooks/send-attempts")] +public class WebhooksSendRecordController : WebhooksManagementControllerBase, IWebhooksSendRecordAppService +{ + protected IWebhooksSendRecordAppService SendRecordAppService { get; } + + public WebhooksSendRecordController(IWebhooksSendRecordAppService sendRecordAppService) + { + SendRecordAppService = sendRecordAppService; + } + + [HttpGet] + [Route("{id}")] + public Task GetAsync(Guid id) + { + return SendRecordAppService.GetAsync(id); + } + + [HttpGet] + public Task> GetListAsync(WebhookSendRecordGetListInput input) + { + return SendRecordAppService.GetListAsync(input); + } + + [HttpPost] + [Route("{id}/resend")] + [Authorize(WebhooksManagementPermissions.WebhooksSendAttempts.Resend)] + public Task ResendAsync(Guid id) + { + return SendRecordAppService.ResendAsync(id); + } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionController.cs similarity index 84% rename from aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs rename to aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionController.cs index 8a94ce6fb..faa517987 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionController.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.HttpApi/LINGYUN/Abp/WebhooksManagement/WebhooksSubscriptionController.cs @@ -12,11 +12,11 @@ namespace LINGYUN.Abp.WebhooksManagement; [Area(WebhooksManagementRemoteServiceConsts.ModuleName)] [Authorize(WebhooksManagementPermissions.WebhookSubscription.Default)] [Route("api/webhooks/subscriptions")] -public class WebhookSubscriptionController : WebhooksManagementControllerBase, IWebhookSubscriptionAppService +public class WebhooksSubscriptionController : WebhooksManagementControllerBase, IWebhooksSubscriptionAppService { - protected IWebhookSubscriptionAppService SubscriptionAppService { get; } + protected IWebhooksSubscriptionAppService SubscriptionAppService { get; } - public WebhookSubscriptionController(IWebhookSubscriptionAppService subscriptionAppService) + public WebhooksSubscriptionController(IWebhooksSubscriptionAppService subscriptionAppService) { SubscriptionAppService = subscriptionAppService; }