remove Features-directory and move the files to the root directory
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.EmailProfiler.Application.Common.Dtos.EmailHistories;
|
||||
using DigitalData.EmailProfiler.Application.Interfaces.Repositories;
|
||||
using MediatR;
|
||||
|
||||
namespace DigitalData.EmailProfiler.Application.EmailHistories.Queries;
|
||||
|
||||
/// <summary>
|
||||
/// Query to get email history by profile with pagination.
|
||||
/// </summary>
|
||||
public record GetEmailHistoryByProfileQuery(
|
||||
int ProfileId,
|
||||
int PageNumber = 1,
|
||||
int PageSize = 50) : IRequest<EmailHistoryPagedResult>;
|
||||
|
||||
/// <summary>
|
||||
/// Paged result for email history.
|
||||
/// </summary>
|
||||
public record EmailHistoryPagedResult(
|
||||
IEnumerable<EmailHistoryDto> Items,
|
||||
int TotalCount,
|
||||
int PageNumber,
|
||||
int PageSize);
|
||||
|
||||
public class GetEmailHistoryByProfileQueryHandler(
|
||||
IEmailHistoryRepository repository,
|
||||
IMapper mapper)
|
||||
: IRequestHandler<GetEmailHistoryByProfileQuery, EmailHistoryPagedResult>
|
||||
{
|
||||
public async Task<EmailHistoryPagedResult> Handle(
|
||||
GetEmailHistoryByProfileQuery request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var (items, totalCount) = await repository.GetByProfileIdAsync(
|
||||
request.ProfileId,
|
||||
request.PageNumber,
|
||||
request.PageSize,
|
||||
cancellationToken);
|
||||
|
||||
var dtos = mapper.Map<IEnumerable<EmailHistoryDto>>(items);
|
||||
|
||||
return new EmailHistoryPagedResult(
|
||||
dtos,
|
||||
totalCount,
|
||||
request.PageNumber,
|
||||
request.PageSize);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user