Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Oct 6, 2023
1 parent 44dd1a9 commit 4662f91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/BUTR.CrashReportServer/Controllers/ReportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ public ActionResult<IEnumerable<FileMetadata>> GetFilenameDates(ICollection<stri

return Ok(_dbContext.Set<IdEntity>()
.Where(x => filenamesWithExtension.Contains(x.FileId))
.Select(x => new { x.FileId, x.CrashReportId, x.Version, x.Created })
.AsAsyncEnumerable()
.Select(x => new FileMetadata(x.FileId, x.CrashReportId, x.Version, x.Created.ToUniversalTime())));
}

Expand All @@ -173,15 +171,12 @@ public ActionResult<IEnumerable<FileMetadata>> GetFilenameDates(ICollection<stri
[HttpsProtocol(Protocol = SslProtocols.Tls13)]
public ActionResult<IEnumerable<FileMetadata>> GetNewCrashReportsDates([FromBody] GetNewCrashReportsBody body, CancellationToken ct)
{
var universal = body.DateTime.ToUniversalTime();
var diff = DateTime.UtcNow - universal;
var diff = DateTime.UtcNow - body.DateTime;
if (diff.Ticks < 0 || diff > TimeSpan.FromDays(30))
return BadRequest();

return Ok(_dbContext.Set<IdEntity>()
.Where(x => x.Created >= universal)
.Select(x => new { x.FileId, x.CrashReportId, x.Version, x.Created })
.AsAsyncEnumerable()
.Where(x => x.Created > body.DateTime)
.Select(x => new FileMetadata(x.FileId, x.CrashReportId, x.Version, x.Created.ToUniversalTime())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("TEXT")
.HasColumnName("crash_report_id");
b.Property<DateTimeOffset>("Created")
b.Property<DateTime>("Created")
.HasColumnType("TEXT")
.HasColumnName("created");
Expand Down

0 comments on commit 4662f91

Please sign in to comment.