コード例 #1
0
        public async Task <ApplicantDto?> Handle(
            GetResumeFromApplicantQuery request,
            CancellationToken cancellationToken
            )
        {
            var applicant = await _applicantRepository.FindAsync(request.ApplicantId, cancellationToken);

            if (applicant is null)
            {
                return(null);
            }

            var result = new ApplicantDto
            {
                Name = applicant.PersonReference.Name
            };

            if (applicant.Resume is not null)
            {
                result.Resume = new ResumeDto
                {
                    Experiences = applicant.Resume.Experiences.Items.Select(
                        e => new ExperienceDto
                    {
                        Company         = e.Company,
                        Description     = e.Description,
                        PeriodStartDate = e.Period.StartDate,
                        PeriodEndDate   = e.Period.EndDate
                    }
                        ),
                    Introduction = applicant.Resume.Introduction
                }
            }
            ;
            return(result);
        }
    }