-
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.
Showing
14 changed files
with
277 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,11 @@ | |
"Token": "745f040659edff0ce87b545567da72d2", | ||
"SenderName": "ProFile", | ||
"SenderEmail": "[email protected]", | ||
"TemplateUuid": "9d6a8f25-65e9-4819-be7d-106ce077acf1" | ||
"TemplateUuids": { | ||
"ResetPassword": "9d6a8f25-65e9-4819-be7d-106ce077acf1", | ||
"ShareEntry": "ad69df89-885a-48fb-b8f6-6d06af1a54e3", | ||
"Request": "bce7e60c-d848-4f80-af96-cccd264dcc32" | ||
} | ||
}, | ||
"Seed": true, | ||
"Serilog" : { | ||
|
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
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
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
37 changes: 37 additions & 0 deletions
37
src/Application/Documents/EventHandlers/RequestCreatedHandler.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,37 @@ | ||
using Application.Common.Interfaces; | ||
using Domain.Events; | ||
using MediatR; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Application.Documents.EventHandlers; | ||
|
||
public class RequestCreatedHandler : INotificationHandler<RequestCreated> | ||
{ | ||
private readonly IApplicationDbContext _context; | ||
private readonly IMailService _mailService; | ||
|
||
public RequestCreatedHandler(IMailService mailService, IApplicationDbContext context) | ||
{ | ||
_mailService = mailService; | ||
_context = context; | ||
} | ||
|
||
public async Task Handle(RequestCreated notification, CancellationToken cancellationToken) | ||
{ | ||
var document = await _context.Documents | ||
.Include(x => x.Department) | ||
.FirstOrDefaultAsync(x => x.Id == notification.DocumentId, cancellationToken); | ||
|
||
var departmentId = document!.Department!.Id; | ||
|
||
var staff = await _context.Staffs | ||
.Include(x => x.User) | ||
.FirstOrDefaultAsync(x => x.Room!.DepartmentId == departmentId, cancellationToken); | ||
|
||
if (staff is not null) | ||
{ | ||
_mailService.SendCreateRequestHtmlMail(notification.UserName, notification.RequestType, notification.Operation, | ||
notification.DocumentTitle, notification.Reason, notification.RequestId, staff.User.Email); | ||
} | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/Application/Entries/EventHandlers/ShareEntryEventHandler.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,21 @@ | ||
using Application.Common.Interfaces; | ||
using Domain.Events; | ||
using MediatR; | ||
|
||
namespace Application.Entries.EventHandlers; | ||
|
||
public class ShareEntryEventHandler : INotificationHandler<ShareEntryEvent> | ||
{ | ||
private readonly IMailService _mailService; | ||
|
||
public ShareEntryEventHandler(IMailService mailService) | ||
{ | ||
_mailService = mailService; | ||
} | ||
|
||
public async Task Handle(ShareEntryEvent notification, CancellationToken cancellationToken) | ||
{ | ||
_mailService.SendShareEntryHtmlMail(notification.IsDirectory, notification.EntryName, notification.SharerName, | ||
notification.Operation, notification.OwnerName, notification.SharedUserEmail, notification.Path); | ||
} | ||
} |
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
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,24 @@ | ||
using Domain.Common; | ||
|
||
namespace Domain.Events; | ||
|
||
public class RequestCreated : BaseEvent | ||
{ | ||
public RequestCreated(string userName, string requestType, string operation, string documentTitle, Guid requestId, string reason, Guid documentId) | ||
{ | ||
UserName = userName; | ||
RequestType = requestType; | ||
Operation = operation; | ||
DocumentTitle = documentTitle; | ||
RequestId = requestId; | ||
Reason = reason; | ||
DocumentId = documentId; | ||
} | ||
public string UserName { get; } | ||
public string RequestType { get; } | ||
public string Operation { get; } | ||
public string DocumentTitle { get; } | ||
public string Reason { get; } | ||
public Guid DocumentId { get; } | ||
public Guid RequestId { get; } | ||
} |
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,25 @@ | ||
using Domain.Common; | ||
|
||
namespace Domain.Events; | ||
|
||
public class ShareEntryEvent : BaseEvent | ||
{ | ||
public ShareEntryEvent(string entryName, string sharerName, string ownerName, string sharedUserEmail, bool isDirectory, string operation, string path) | ||
{ | ||
EntryName = entryName; | ||
SharerName = sharerName; | ||
OwnerName = ownerName; | ||
SharedUserEmail = sharedUserEmail; | ||
IsDirectory = isDirectory; | ||
Operation = operation; | ||
Path = path; | ||
} | ||
|
||
public string EntryName { get; } | ||
public string SharerName { get; } | ||
public string OwnerName { get; } | ||
public string SharedUserEmail { get; } | ||
public bool IsDirectory { get; } | ||
public string Operation { get; } | ||
public string Path { get; } | ||
} |
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
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
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
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