using AutoMapper; using MediatR; using ExpenseTracker.Application.Common.Interfaces.Repositories; using ExpenseTracker.Domain.Entities; namespace ExpenseTracker.Application.Accounts.Queries.Get; public class GetAccountQueryHandler : IRequestHandler { private readonly IMapper _mapper; private readonly IAccountRepository _accountRepository; private readonly ITransactionRepository _transactionRepository; public GetAccountQueryHandler( IMapper mapper, IAccountRepository repository, ITransactionRepository transactionRepository) { _mapper = mapper; _accountRepository = repository; _transactionRepository = transactionRepository; } public async Task Handle(GetAccountQuery request, CancellationToken cancellationToken) { var entity = _accountRepository.Queryable .FirstOrDefault(e => e.Id == request.Id); return _mapper.Map(entity); } }