fix(audit): sentinel timestamps вместо :from IS NULL в JPQL

PostgreSQL не может вывести тип параметра OffsetDateTime когда оба боковых
выражения IS NULL ⇒ 500 на /api/v1/admin/audit. Фикс — controller подставляет
0001-01-01/9999-12-31 если from/to не указаны, JPQL использует обычное
сравнение eventTime BETWEEN :from AND :to. Строковые фильтры (dictionary,
user, action, businessKey) остаются с :p IS NULL OR x = :p — они работают
потому что VARCHAR PG может вывести из правой стороны сравнения.
This commit is contained in:
Zimin A.N.
2026-05-04 16:02:03 +03:00
parent 5ffb51e119
commit 2a82e0d6a3
2 changed files with 10 additions and 6 deletions
@@ -52,8 +52,8 @@ public class AuditAdminController {
nullIfBlank(userId),
nullIfBlank(action),
nullIfBlank(businessKey),
from,
to,
from == null ? OffsetDateTime.parse("0001-01-01T00:00:00Z") : from,
to == null ? OffsetDateTime.parse("9999-12-31T23:59:59Z") : to,
PageRequest.of(page, Math.min(size, 200), Sort.by(Sort.Direction.DESC, "eventTime")));
return result.map(AuditEntry::from);
}
@@ -71,8 +71,8 @@ public class AuditAdminController {
nullIfBlank(userId),
nullIfBlank(action),
nullIfBlank(businessKey),
from,
to,
from == null ? OffsetDateTime.parse("0001-01-01T00:00:00Z") : from,
to == null ? OffsetDateTime.parse("9999-12-31T23:59:59Z") : to,
PageRequest.of(0, MAX_EXPORT_ROWS, Sort.by(Sort.Direction.DESC, "eventTime")));
StringBuilder csv = new StringBuilder(