revize endpointu: cteni NullableProperty, filtr v UTC, attachments

Kontrola vsech 180 operaci proti falesnemu iDoklad API a round trip
331 modelu SDK v obou smerech.

- SdkNullablePropertyConverter doplnuje cteni NullableProperty<T>.
  Konvertor SDK umi jen zapis, takze PATCH s takovou polozkou koncil
  prazdnou 500 uz pri cteni tela. Tykalo se 29 modelu. Zapis zustava
  na konvertoru SDK, odchozi payload se nemeni.
- Datum uvnitr NullableProperty se normalizuje na UTC stejne jako
  zbytek serializace.
- ListModifiers parsuje datum ve filtru s AdjustToUniversal a
  AssumeUniversal. Filtr se zonou se drive posouval o offset.
- POST /attachments kontroluje FileName a FileBytes, SDK na ne sahalo
  bez kontroly na null a vracelo neosetrenou 500.
- ExceptionHandlingMiddleware ma posledni zachyt, zadny request uz
  nekonci prazdnou 500.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
JiriUhlir
2026-08-25 11:13:21 +02:00
co-authored by Claude Opus 5
parent 73f01d0228
commit 225161e4ca
7 changed files with 194 additions and 11 deletions
@@ -79,6 +79,14 @@ public sealed class ExceptionHandlingMiddleware
// Thrown by the SDK when required credential fields are blank/invalid.
await WriteProblem(context, HttpStatusCode.BadRequest, ex.Message, null);
}
catch (Exception ex)
{
// Last resort: without this the response is a 500 with an empty body, which tells the
// caller nothing. The exception type is enough to locate the cause in the container log;
// no stack trace or request data is exposed.
_logger.LogError(ex, "Unhandled error while processing the request.");
await WriteProblem(context, HttpStatusCode.InternalServerError, $"Unexpected error ({ex.GetType().Name}). See the service log for details.", null);
}
}
private static async Task WriteProblem(HttpContext context, HttpStatusCode status, string detail, IDictionary<string, object?>? extensions)
@@ -114,6 +122,7 @@ public sealed class ExceptionHandlingMiddleware
HttpStatusCode.Unauthorized => "Unauthorized",
HttpStatusCode.BadRequest => "Bad Request",
HttpStatusCode.BadGateway => "Upstream iDoklad API error",
HttpStatusCode.InternalServerError => "Internal Server Error",
_ => status.ToString(),
};
}