17 lines
701 B
C#
17 lines
701 B
C#
namespace Brizco.Repository.Handlers.Activities;
|
|
|
|
public class GetActivityQueryHandler(IRepositoryWrapper repositoryWrapper)
|
|
: IRequestHandler<GetActivityQuery, ActivityLDto>
|
|
{
|
|
public async Task<ActivityLDto> Handle(GetActivityQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var task = await repositoryWrapper.SetRepository<Domain.Entities.Tasks.Activity>()
|
|
.TableNoTracking
|
|
.Where(s => s.Id == request.Id)
|
|
.Select(ActivityMapper.ProjectToLDto)
|
|
.FirstOrDefaultAsync(cancellationToken);
|
|
if (task == null)
|
|
throw new AppException("Task not found", ApiResultStatusCode.NotFound);
|
|
return task;
|
|
}
|
|
} |