Exemple #1
0
        public async Task Handle(DeleteJobApplicationCommand request, CancellationToken cancellationToken)
        {
            var appl = await _jobApplicationRepository.GetAsync(request.Id);

            _jobApplicationRepository.Delete(appl);
            await _jobApplicationRepository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation("----- Deleted job application: {@Id}", request.Id);
        }
Exemple #2
0
        public async Task <JobApplicationDto> Handle(MakeJobApplicationDecisionCommand request, CancellationToken cancellationToken)
        {
            var jobApplication = await _jobApplicationRepository.GetAsync(request.ApplicationId)
                                 ?? throw new PersonnelDomainException("Could not submit job application decision", new[] { $"Job application with id {request.ApplicationId} does not exist" });

            var myId = _identityService.GetUserIdentity();

            jobApplication.MakeDecision(request.Decision, myId);
            _jobApplicationRepository.Update(jobApplication);

            _logger.LogInformation("----- Saving job application decision - Id: {@Id}, Decision: {@Decision}", request.ApplicationId, request.Decision);

            await _jobApplicationRepository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation("----- Saved job application decision - Id: {@Id}, Decision: {@Decision}", request.ApplicationId, request.Decision);

            return(await _employmentQueries.GetJobApplicationByIdAsync(jobApplication.Id));
        }