set path position

This commit is contained in:
Kittapath 2023-04-09 23:15:08 +07:00
parent 5abeada4a6
commit 899826e882
7 changed files with 295 additions and 266 deletions

View file

@ -8,10 +8,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
public string? Id { get; set; } public string? Id { get; set; }
public string? Category { get; set; } public string? Category { get; set; }
public string? Category_id { get; set; } public string? Category_id { get; set; }
public DateTime? Start { get; set; } public string? Start { get; set; }
public DateTime? End { get; set; } public string? End { get; set; }
public DateTime? Exam_date { get; set; } public string? Exam_date { get; set; }
public DateTime? Announcement_date { get; set; } public string? Announcement_date { get; set; }
public string? Announcement_endDate { get; set; }
public string? Title { get; set; } public string? Title { get; set; }
public string? Detail { get; set; } public string? Detail { get; set; }
public string? Image { get; set; } public string? Image { get; set; }

View file

@ -34,6 +34,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
_minioService = minioService; _minioService = minioService;
} }
public static IConfigurationRoot Configuration
{
get
{
return new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
}
}
#endregion #endregion
#region " Properties " #region " Properties "
@ -325,10 +336,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Id = x.Id.ToString(), Id = x.Id.ToString(),
Category = "doctor", Category = "doctor",
Category_id = "doctor", Category_id = "doctor",
Start = x.ExamDate, Start = x.ExamDate.ToShortDateString(),
End = x.ExamDate, End = x.ExamDate.ToShortDateString(),
Exam_date = x.ExamDate, Exam_date = x.ExamDate.ToShortDateString(),
Announcement_date = x.AnnouncementStartDate, Announcement_date = x.AnnouncementStartDate.ToShortDateString(),
Announcement_endDate = x.AnnouncementEndDate.ToShortDateString(),
Title = x.Name, Title = x.Name,
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ? Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
"" : "" :
@ -356,12 +368,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var periodExam = await _context.PeriodExams.AsQueryable() var periodExam = await _context.PeriodExams.AsQueryable()
.Where(x => x.Id == Guid.Parse(examId)) .Where(x => x.Id == Guid.Parse(examId))
.Include(x => x.PeriodExamImages) .Include(x => x.PeriodExamImages)
.Include(x => x.PeriodExamDocuments)
.Include(x => x.PositionExam)
.Select(x => new CMSExamResponseItem .Select(x => new CMSExamResponseItem
{ {
Id = x.Id.ToString(), Id = x.Id.ToString(),
Category = "doctor", Category = "doctor",
Category_id = "doctor", Category_id = "doctor",
Start = x.ExamDate, Start = x.AnnouncementStartDate.ToShortDateString(),
End = x.AnnouncementEndDate.ToShortDateString(),
Title = x.Name, Title = x.Name,
Detail = x.Detail, Detail = x.Detail,
Images = x.PeriodExamImages.Select(s => new HomePageLinkResponseItem Images = x.PeriodExamImages.Select(s => new HomePageLinkResponseItem
@ -377,7 +392,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
Positions = x.PositionExam.Select(s => new HomePageLinkResponseItem Positions = x.PositionExam.Select(s => new HomePageLinkResponseItem
{ {
Title = s.Id.ToString(), Title = s.Id.ToString(),
Url = $"{x.Id}/{s.Id}", Url = $"{Configuration.GetValue<string>("Domain")}/exam/{x.Id}/{s.Id}",
}).ToList(), }).ToList(),
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@ -385,6 +400,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (periodExam == null) if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
if (periodExam.Positions.Count() == 0)
{
periodExam.Positions.Add(new HomePageLinkResponseItem
{
Title = "x.Name",
Url = $"{Configuration.GetValue<string>("Domain")}/exam/{periodExam.Id}/00000000-0000-0000-0000-000000000000"
});
}
var i = 0; var i = 0;
foreach (var item in periodExam.Images) foreach (var item in periodExam.Images)
{ {

View file

@ -30,5 +30,6 @@
"AccessKey": "frappet", "AccessKey": "frappet",
"SecretKey": "P@ssw0rd", "SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit" "BucketName": "bma-recruit"
} },
"Domain": "http://localhost:5173"
} }

View file

@ -30,5 +30,6 @@
"AccessKey": "frappet", "AccessKey": "frappet",
"SecretKey": "P@ssw0rd", "SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit" "BucketName": "bma-recruit"
} },
"Domain": "http://localhost:5173"
} }

View file

@ -30,5 +30,6 @@
"AccessKey": "frappet", "AccessKey": "frappet",
"SecretKey": "P@ssw0rd", "SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit" "BucketName": "bma-recruit"
} },
"Domain": "http://localhost:5173"
} }

View file

@ -30,5 +30,6 @@
"AccessKey": "frappet", "AccessKey": "frappet",
"SecretKey": "P@ssw0rd", "SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit" "BucketName": "bma-recruit"
} },
"Domain": "http://localhost:5173"
} }

File diff suppressed because it is too large Load diff