You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- In `save()` create branch, do not pass `id` when it is `None` (DB identity assigns). Replace lines 80-91 with:
469
+
- In `save()` create branch, do not pass `id` when it is `None` (DB identity assigns) AND flush before creating the default related records so `user_model.id` is populated (otherwise `user_id` is NULL → IntegrityError). Replace lines 80-91 with:
470
470
471
471
```python
472
472
else:
@@ -484,28 +484,32 @@ git commit -m "refactor: user infrastructure models use integer foreign keys"
(`user.tenant_id` — add a `tenant_id: int | None = None` field to the `User` dataclass in `user.py` (Task 4) if it does not exist; check first: `user.py` has no `tenant_id` field — add `tenant_id: int | None = None` after `updated_at`.)
493
+
(`user.tenant_id` — add a `tenant_id: int | None = None` field to the `User` dataclass in `user.py` (Task 4) if it does not exist; check first: `user.py` has no `tenant_id` field — add `tenant_id: int | None = None` after `updated_at`. The `User` dataclass is `kw_only` (Task 4), so field order is flexible.)
-`save()` — replace the `merge` flow with insert-without-id (identity assigns) and map back from refreshed model:
498
+
-`save()` — do not pass `id` when `None` (DB identity assigns) AND keep update semantics for existing tokens (the caller `refresh_token/handler.py` revokes an existing token then saves it — insert-only would duplicate the row and never revoke the original). Use merge + conditional id:
0 commit comments