Refactor V3 CRUD: Extract nested child routes into separate router.

- Created app/routers/api_crud_v3_nested.py to handle all parent-child relational routes.
- Updated app/routers/api_crud_v3.py to include the nested router, significantly reducing file size.
- Documented Phase 2 completion in documentation/REFACTOR_API_CRUD_V3.md.
This commit is contained in:
Scott Idem
2026-01-09 16:23:14 -05:00
parent 8459b57e1b
commit 812181acb5
3 changed files with 345 additions and 320 deletions

View File

@@ -8,20 +8,13 @@
1. **Create `app/lib_api_crud_v3.py`**: DONE
2. **Update `app/routers/api_crud_v3.py`**: DONE (All endpoints now use `sanitize_payload`).
## Phase 2: Separate Child/Nested Routes - PLANNED
## Phase 2: Separate Child/Nested Routes - COMPLETED
**Objective:** Reduce file size by splitting standard CRUD from relational CRUD.
1. **Create `app/routers/api_crud_v3_nested.py`**:
* Move `get_child_obj_li`
* Move `post_child_obj`
* Move `get_child_obj`
* Move `patch_child_obj`
* Move `delete_child_obj`
1. **Create `app/routers/api_crud_v3_nested.py`**: DONE
2. **Update `app/routers/api_crud_v3.py`**: DONE (Included via `router.include_router`)
2. **Update `app/main.py` (or router inclusion)**:
* Ensure the new router is included, OR include it within `api_crud_v3.py` if preferred to keep a single import point.
## Phase 3: Schema Introspection
**Objective:** Isolate database introspection logic.
## Phase 3: Schema Introspection - PLANNED
1. **Create `app/lib_schema_v3.py` (or similar)**:
* Move the logic inside `get_obj_schema` (SQL `DESCRIBE` parsing, Pydantic introspection) to a helper function.