feat(annotations): add polygon JSONB support for quadrilateral shapes

- V23 migration adds polygon JSONB column with 4-point CHECK constraint
- PolygonConverter: AttributeConverter for List<List<Double>> <-> JSONB
- @UniquePoints custom validator rejects duplicate coordinates
- CreateAnnotationDTO: validated optional polygon field
- DocumentAnnotation entity: polygon field with converter

Refs #227

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-12 15:10:35 +02:00
parent ec32d225b5
commit 878a90a86d
8 changed files with 291 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
-- Add optional polygon field for quadrilateral annotation shapes (Kraken OCR output).
-- See ADR-002 for the design decision.
ALTER TABLE document_annotations ADD COLUMN polygon JSONB;
ALTER TABLE document_annotations
ADD CONSTRAINT chk_annotation_polygon_quad
CHECK (polygon IS NULL OR jsonb_array_length(polygon) = 4);