diff --git a/documentation/BOOTSTRAP__AI_Agent_Quickstart.md b/documentation/BOOTSTRAP__AI_Agent_Quickstart.md index 3da5164..0912952 100644 --- a/documentation/BOOTSTRAP__AI_Agent_Quickstart.md +++ b/documentation/BOOTSTRAP__AI_Agent_Quickstart.md @@ -252,6 +252,15 @@ When a table or view gains, loses, or renames fields — **do all of these in or 5. Run the relevant schema/search E2E tests 6. **Restart Docker:** `docker compose restart ae_api` +#### FK fields with non-matching prefixes + +The generic `sanitize_payload()` in `lib_api_crud_v3.py` derives the lookup table name by stripping `_id` from the field name (`event_location_id` → `event_location` ✓). If a field has a prefix that doesn't match the table (`poc_person_id` → would look up `poc_person`, but the table is `person`), the random string reaches the DB as-is and MariaDB throws a 1366 integer error. + +Fix: add a mapping to the special-case block in `sanitize_payload()` (same file, same block as `address_location → address`): +```python +if obj_type_lookup == 'poc_person': obj_type_lookup = 'person' +``` + #### Alt-view fields (in `tbl_alt` only) Some objects have a richer alternate SQL view triggered by `?view=alt`. These fields **must still be declared in the Pydantic model and `searchable_fields`** even if they only