Add fileDto to reportprops dto. For unification download mechanism.

This commit is contained in:
Фролов 2021-09-30 12:38:29 +05:00
parent 90bdb264cb
commit 4c08a2963f
2 changed files with 23 additions and 8 deletions

View File

@ -6,7 +6,7 @@ namespace AsbCloudApp.Data
{
public int Id { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public FileInfoDto File { get; set; }
public int IdWell { get; set; }
public DateTime Date { get; set; }
public DateTimeOffset Begin { get; set; }

View File

@ -128,9 +128,7 @@ namespace AsbCloudInfrastructure.Services
};
}
[Obsolete]
Task<List<ReportPropertiesDto>> IReportService.GetSuitableReportsAsync(int idWell, DateTime begin, DateTime end, int stepSeconds, int format, CancellationToken token) =>
public Task<List<ReportPropertiesDto>> GetSuitableReportsAsync(int idWell, DateTime begin, DateTime end, int stepSeconds, int format, CancellationToken token) =>
(from r in db.ReportProperties.Include(r => r.File)
where r.IdWell == idWell
&& r.Begin >= begin
@ -141,7 +139,16 @@ namespace AsbCloudInfrastructure.Services
{
Id = r.Id,
Name = r.File.Name,
Url = fileService.GetUrl(r.IdFile),
File = new FileInfoDto{
Id = r.File.Id,
Author = null,
IdAuthor = r.File.IdAuthor??0,
IdCategory = r.File.IdCategory,
IdWell = r.File.IdWell,
Name = r.File.Name,
Size = r.File.Size,
UploadDate = r.File.UploadDate,
},
IdWell = r.IdWell,
Date = r.File.UploadDate,
Begin = r.Begin,
@ -160,9 +167,17 @@ namespace AsbCloudInfrastructure.Services
{
Id = r.Id,
Name = r.File.Name,
#pragma warning disable IDE0057 // Use range operator
Url = fileService.GetUrl(r.IdWell, ReportCategoryId, r.File.Id, r.File.Name.Substring(r.File.Name.LastIndexOf(".") > 0 ? r.File.Name.LastIndexOf(".") : r.File.Name.Length)),
#pragma warning restore IDE0057 // Use range operator
File = new FileInfoDto
{
Id = r.File.Id,
Author = null,
IdAuthor = r.File.IdAuthor ?? 0,
IdCategory = r.File.IdCategory,
IdWell = r.File.IdWell,
Name = r.File.Name,
Size = r.File.Size,
UploadDate = r.File.UploadDate,
},
IdWell = r.IdWell,
Date = r.File.UploadDate,
Begin = r.Begin,