mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-27 07:41:15 +00:00
[AZ-1126] Migrate capturedAt to DateTimeOffset
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -54,9 +54,9 @@ public sealed class UavTileMetadataValidator : AbstractValidator<UavTileMetadata
|
||||
// time per call (rule executes at validation time, not constructor
|
||||
// time). Equivalent to AZ-488 Rule 4 in UavTileQualityGate.
|
||||
RuleFor(m => m.CapturedAt)
|
||||
.Must(capturedAt => capturedAt.ToUniversalTime() <= tp.GetUtcNow().UtcDateTime.AddSeconds(futureSkewSeconds))
|
||||
.Must(capturedAt => capturedAt.UtcDateTime <= tp.GetUtcNow().UtcDateTime.AddSeconds(futureSkewSeconds))
|
||||
.WithMessage($"`capturedAt` must be within {futureSkewSeconds}s of the current time (no future-dated tiles).")
|
||||
.Must(capturedAt => capturedAt.ToUniversalTime() >= tp.GetUtcNow().UtcDateTime.AddDays(-maxAgeDays))
|
||||
.Must(capturedAt => capturedAt.UtcDateTime >= tp.GetUtcNow().UtcDateTime.AddDays(-maxAgeDays))
|
||||
.WithMessage($"`capturedAt` must be within the last {maxAgeDays} days.");
|
||||
|
||||
// `FlightId` is intentionally not validated beyond JSON shape — AZ-503
|
||||
|
||||
@@ -73,11 +73,12 @@ public sealed class UavUploadValidationFilter : IEndpointFilter
|
||||
{
|
||||
payload = JsonSerializer.Deserialize<UavTileBatchMetadataPayload>(metadataField, _jsonOptions);
|
||||
}
|
||||
catch (JsonException)
|
||||
catch (JsonException ex)
|
||||
{
|
||||
var message = string.IsNullOrWhiteSpace(ex.Message) ? MetadataJsonParseError : ex.Message;
|
||||
return Results.ValidationProblem(new Dictionary<string, string[]>
|
||||
{
|
||||
[MetadataField] = new[] { MetadataJsonParseError },
|
||||
[MetadataField] = new[] { message },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user