Changed exceptions, added action for closing applications by applicant
This commit is contained in:
		| @@ -21,12 +21,12 @@ public sealed class ApplicantsRepository(IGenericReader reader, IGenericWriter w | ||||
|     async Task<Applicant> IApplicantsRepository.FindByUserIdAsync(Guid userId, CancellationToken cancellationToken) | ||||
|     { | ||||
|         var result = await LoadDomain().SingleOrDefaultAsync(a => a.UserId == userId, cancellationToken); | ||||
|         return result ?? throw new ApplicantNotFoundByUserIdException(userId); | ||||
|         return result ?? throw new ApplicantNotFoundByUserIdException(); | ||||
|     } | ||||
|  | ||||
|     async Task<Guid> IApplicantsRepository.GetApplicantIdByUserId(Guid userId, CancellationToken cancellationToken) | ||||
|     { | ||||
|         var result = await base.LoadDomain().SingleOrDefaultAsync(a => a.UserId == userId, cancellationToken); | ||||
|         return result?.Id ?? throw new ApplicantNotFoundByUserIdException(userId); | ||||
|         return result?.Id ?? throw new ApplicantNotFoundByUserIdException(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,8 +3,5 @@ using Domains.ApplicantDomain; | ||||
|  | ||||
| namespace Infrastructure.Database.Applicants.Repositories.Exceptions | ||||
| { | ||||
|     public class ApplicantNotFoundByUserIdException(Guid id) : EntityNotFoundException<Applicant>("Applicant not found.") | ||||
|     { | ||||
|         public Guid UserId { get; private set; } = id; | ||||
|     } | ||||
|     public class ApplicantNotFoundByUserIdException() : EntityNotFoundException("Applicant not found."); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user