-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2c1283
commit a31b998
Showing
34 changed files
with
607 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...orker/Notification.Worker/Application/Commands/Retry/Base/RetrySendNotificationCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Runtime.Serialization; | ||
using Notification.Core.Common.CQRS; | ||
|
||
namespace Notification.Worker.Application.Commands.Send.Base; | ||
|
||
public abstract class RetrySendNotificationCommand : Command | ||
{ | ||
protected RetrySendNotificationCommand(string correlationId) | ||
{ | ||
CorrelationId = correlationId; | ||
} | ||
|
||
[DataMember] | ||
public string CorrelationId { get; private set; } | ||
} | ||
|
35 changes: 35 additions & 0 deletions
35
...on.Worker/Application/Commands/Retry/Handlers/RetrySendNotificationEmailCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Notification.Core.Common.Domain; | ||
using Notification.Worker.Data.Repositories.Interfaces; | ||
using Notification.Worker.Domain.Services.Interfaces; | ||
|
||
namespace Notification.Worker.Application.Commands.Handlers; | ||
|
||
public class RetrySendNotificationEmailCommandHandler : IRequestHandler<RetrySendNotificationEmailCommand, IActionResult> | ||
{ | ||
public RetrySendNotificationEmailCommandHandler(INotificationRepository notificationRepository, IEmailServices emailServices) | ||
{ | ||
_notificationRepository = notificationRepository; | ||
_emailServices = emailServices; | ||
} | ||
|
||
private readonly INotificationRepository _notificationRepository; | ||
private readonly IEmailServices _emailServices; | ||
|
||
public async Task<IActionResult> Handle(RetrySendNotificationEmailCommand request, CancellationToken cancellationToken) | ||
{ | ||
Domain.Notification notification = await _notificationRepository.GetByCorrelationId(request.AggregateId); | ||
|
||
if (notification == null) | ||
throw new DomainException("Notification not exists."); | ||
|
||
await notification.Send(_emailServices); | ||
|
||
_notificationRepository.Update(notification); | ||
|
||
await _notificationRepository.unitOfWork.Commit(); | ||
|
||
return new OkResult(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...n.Worker/Application/Commands/Retry/Handlers/RetrySendNotificationLetterCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Notification.Core.Common.Domain; | ||
using Notification.Worker.Data.Repositories.Interfaces; | ||
using Notification.Worker.Domain.Services.Interfaces; | ||
|
||
namespace Notification.Worker.Application.Commands.Handlers; | ||
|
||
public class RetrySendNotificationLetterCommandHandler : IRequestHandler<RetrySendNotificationLetterCommand, IActionResult> | ||
{ | ||
public RetrySendNotificationLetterCommandHandler(INotificationRepository notificationRepository, IEmailServices emailServices) | ||
{ | ||
_notificationRepository = notificationRepository; | ||
_emailServices = emailServices; | ||
} | ||
|
||
private readonly INotificationRepository _notificationRepository; | ||
private readonly IEmailServices _emailServices; | ||
|
||
public async Task<IActionResult> Handle(RetrySendNotificationLetterCommand request, CancellationToken cancellationToken) | ||
{ | ||
Domain.Notification notification = await _notificationRepository.GetByCorrelationId(request.AggregateId); | ||
|
||
if (notification == null) | ||
throw new DomainException("Notification not exists."); | ||
|
||
await notification.Send(_emailServices); | ||
|
||
_notificationRepository.Update(notification); | ||
|
||
await _notificationRepository.unitOfWork.Commit(); | ||
|
||
return new OkResult(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ion.Worker/Application/Commands/Retry/Handlers/RetrySendNotificationPushCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Notification.Core.Common.Domain; | ||
using Notification.Worker.Data.Repositories.Interfaces; | ||
using Notification.Worker.Domain.Services.Interfaces; | ||
|
||
namespace Notification.Worker.Application.Commands.Handlers; | ||
|
||
public class RetrySendNotificationPushCommandHandler : IRequestHandler<RetrySendNotificationPushCommand, IActionResult> | ||
{ | ||
public RetrySendNotificationPushCommandHandler(INotificationRepository notificationRepository, IEmailServices emailServices) | ||
{ | ||
_notificationRepository = notificationRepository; | ||
_emailServices = emailServices; | ||
} | ||
|
||
private readonly INotificationRepository _notificationRepository; | ||
private readonly IEmailServices _emailServices; | ||
|
||
public async Task<IActionResult> Handle(RetrySendNotificationPushCommand request, CancellationToken cancellationToken) | ||
{ | ||
Domain.Notification notification = await _notificationRepository.GetByCorrelationId(request.AggregateId); | ||
|
||
if (notification == null) | ||
throw new DomainException("Notification not exists."); | ||
|
||
await notification.Send(_emailServices); | ||
|
||
_notificationRepository.Update(notification); | ||
|
||
await _notificationRepository.unitOfWork.Commit(); | ||
|
||
return new OkResult(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...tion.Worker/Application/Commands/Retry/Handlers/RetrySendNotificationSMSCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Notification.Core.Common.Domain; | ||
using Notification.Worker.Data.Repositories.Interfaces; | ||
using Notification.Worker.Domain.Services.Interfaces; | ||
|
||
namespace Notification.Worker.Application.Commands.Handlers; | ||
|
||
public class RetrySendNotificationSMSCommandHandler : IRequestHandler<RetrySendNotificationSMSCommand, IActionResult> | ||
{ | ||
public RetrySendNotificationSMSCommandHandler(INotificationRepository notificationRepository, IEmailServices emailServices) | ||
{ | ||
_notificationRepository = notificationRepository; | ||
_emailServices = emailServices; | ||
} | ||
|
||
private readonly INotificationRepository _notificationRepository; | ||
private readonly IEmailServices _emailServices; | ||
|
||
public async Task<IActionResult> Handle(RetrySendNotificationSMSCommand request, CancellationToken cancellationToken) | ||
{ | ||
Domain.Notification notification = await _notificationRepository.GetByCorrelationId(request.AggregateId); | ||
|
||
if (notification == null) | ||
throw new DomainException("Notification not exists."); | ||
|
||
await notification.Send(_emailServices); | ||
|
||
_notificationRepository.Update(notification); | ||
|
||
await _notificationRepository.unitOfWork.Commit(); | ||
|
||
return new OkResult(); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...Worker/Application/Commands/Retry/Handlers/RetrySendNotificationWhatsAppCommandHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Notification.Core.Common.Domain; | ||
using Notification.Worker.Data.Repositories.Interfaces; | ||
using Notification.Worker.Domain.Services.Interfaces; | ||
|
||
namespace Notification.Worker.Application.Commands.Handlers; | ||
|
||
public class RetrySendNotificationWhatsAppCommandHandler : IRequestHandler<RetrySendNotificationWhatsAppCommand, IActionResult> | ||
{ | ||
public RetrySendNotificationWhatsAppCommandHandler(INotificationRepository notificationRepository, IEmailServices emailServices) | ||
{ | ||
_notificationRepository = notificationRepository; | ||
_emailServices = emailServices; | ||
} | ||
|
||
private readonly INotificationRepository _notificationRepository; | ||
private readonly IEmailServices _emailServices; | ||
|
||
public async Task<IActionResult> Handle(RetrySendNotificationWhatsAppCommand request, CancellationToken cancellationToken) | ||
{ | ||
Domain.Notification notification = await _notificationRepository.GetByCorrelationId(request.AggregateId); | ||
|
||
if (notification == null) | ||
throw new DomainException("Notification not exists."); | ||
|
||
await notification.Send(_emailServices); | ||
|
||
_notificationRepository.Update(notification); | ||
|
||
await _notificationRepository.unitOfWork.Commit(); | ||
|
||
return new OkResult(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...orker/Notification.Worker/Application/Commands/Retry/RetrySendNotificationEmailCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Notification.Core.Common.CQRS; | ||
using Notification.Worker.Application.Commands.Send.Base; | ||
|
||
namespace Notification.Worker.Application.Commands; | ||
|
||
public class RetrySendNotificationEmailCommand : RetrySendNotificationCommand | ||
{ | ||
public RetrySendNotificationEmailCommand(string correlationId) : base(correlationId) | ||
{ | ||
|
||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
...rker/Notification.Worker/Application/Commands/Retry/RetrySendNotificationLetterCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Notification.Worker.Application.Commands.Send.Base; | ||
|
||
namespace Notification.Worker.Application.Commands; | ||
|
||
public class RetrySendNotificationLetterCommand : RetrySendNotificationCommand | ||
{ | ||
public RetrySendNotificationLetterCommand(string correlationId) : base(correlationId) | ||
{ | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...Worker/Notification.Worker/Application/Commands/Retry/RetrySendNotificationPushCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Notification.Worker.Application.Commands.Send.Base; | ||
|
||
namespace Notification.Worker.Application.Commands; | ||
|
||
public class RetrySendNotificationPushCommand : RetrySendNotificationCommand | ||
{ | ||
public RetrySendNotificationPushCommand(string correlationId) : base(correlationId) | ||
{ | ||
|
||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Worker/Notification.Worker/Application/Commands/Retry/RetrySendNotificationSMSCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Runtime.Serialization; | ||
using Notification.Core.Common.CQRS; | ||
using Notification.Core.Domain.Enums; | ||
using Notification.Worker.Application.Commands.Send.Base; | ||
|
||
namespace Notification.Worker.Application.Commands; | ||
|
||
public class RetrySendNotificationSMSCommand : RetrySendNotificationCommand | ||
{ | ||
public RetrySendNotificationSMSCommand(string correlationId) : base(correlationId) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
|
11 changes: 11 additions & 0 deletions
11
...er/Notification.Worker/Application/Commands/Retry/RetrySendNotificationWhatsAppCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Notification.Worker.Application.Commands.Send.Base; | ||
|
||
namespace Notification.Worker.Application.Commands; | ||
|
||
public class RetrySendNotificationWhatsAppCommand : RetrySendNotificationCommand | ||
{ | ||
public RetrySendNotificationWhatsAppCommand(string correlationId) : base(correlationId) | ||
{ | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...cation.Worker/Application/Events/Handlers/NotificationEmailDeliveryFailureEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MediatR; | ||
|
||
namespace Notification.Worker.Domain.Events.Handlers; | ||
|
||
public class NotificationEmailDeliveryFailureEventHandler : INotificationHandler<NotificationEmailDeliveryFailureEvent> | ||
{ | ||
public Task Handle(NotificationEmailDeliveryFailureEvent notification, CancellationToken cancellationToken) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ation.Worker/Application/Events/Handlers/NotificationLetterDeliveryFailureEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MediatR; | ||
|
||
namespace Notification.Worker.Domain.Events.Handlers; | ||
|
||
public class NotificationLetterDeliveryFailureEventHandler : INotificationHandler<NotificationLetterDeliveryFailureEvent> | ||
{ | ||
public Task Handle(NotificationLetterDeliveryFailureEvent notification, CancellationToken cancellationToken) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ication.Worker/Application/Events/Handlers/NotificationPushDeliveryFailureEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MediatR; | ||
|
||
namespace Notification.Worker.Domain.Events.Handlers; | ||
|
||
public class NotificationPushDeliveryFailureEventHandler : INotificationHandler<NotificationPushDeliveryFailureEvent> | ||
{ | ||
public Task Handle(NotificationPushDeliveryFailureEvent notification, CancellationToken cancellationToken) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...fication.Worker/Application/Events/Handlers/NotificationSMSDeliveryFailureEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MediatR; | ||
|
||
namespace Notification.Worker.Domain.Events.Handlers; | ||
|
||
public class NotificationSMSDeliveryFailureEventHandler : INotificationHandler<NotificationSMSDeliveryFailureEvent> | ||
{ | ||
public Task Handle(NotificationSMSDeliveryFailureEvent notification, CancellationToken cancellationToken) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ion.Worker/Application/Events/Handlers/NotificationWhatsAppDeliveryFailureEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MediatR; | ||
|
||
namespace Notification.Worker.Domain.Events.Handlers; | ||
|
||
public class NotificationWhatsAppDeliveryFailureEventHandler : INotificationHandler<NotificationWhatsAppDeliveryFailureEvent> | ||
{ | ||
public Task Handle(NotificationWhatsAppDeliveryFailureEvent notification, CancellationToken cancellationToken) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.