fix(crud): resolve poc_person_id and poc_event_person_id FKs correctly

The generic FK resolver derives the lookup table name from the field name,
so poc_person_id → 'poc_person' (no such table) — the random string was
passed straight to an INT column, producing a MariaDB 1366 error.

Adds table name overrides matching the existing address_location → address
pattern. Blocking LCI session POC assignment via V3 PATCH.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-12 15:46:53 -04:00
parent eff5f854db
commit 2d611a2872

View File

@@ -246,6 +246,8 @@ def sanitize_payload(data: dict, model: Any, ignore_extra: bool = False) -> None
if target_id_field and obj_type_lookup:
# Special table mapping if needed
if obj_type_lookup == 'address_location': obj_type_lookup = 'address'
if obj_type_lookup == 'poc_person': obj_type_lookup = 'person'
if obj_type_lookup == 'poc_event_person': obj_type_lookup = 'event_person'
resolved_id = redis_lookup_id_random(record_id_random=v, table_name=obj_type_lookup)
if resolved_id: