🐛 Strict proxy-table field naming

This worked in SQlite3, but threw when using PostgreSQL.
This commit is contained in:
Brian Wiborg 2025-10-27 10:45:19 +01:00
parent ed30291a4c
commit 9d2e284da3
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View file

@ -30,7 +30,11 @@ class User(Model):
is_admin: bool = field.BooleanField(default=False)
is_staff: bool = field.BooleanField(default=False)
groups: field.ManyToManyRelation[Group] = field.ManyToManyField(
"ohmyapi_auth.Group", related_name="users", through="ohmyapi_auth_user_groups"
"ohmyapi_auth.Group",
related_name="users",
through="ohmyapi_auth.UserGroups",
forward_key="user_id",
backward_key="group_id",
)
class Schema:

View file

@ -214,7 +214,7 @@ async def refresh_token(refresh_token: TokenRefresh = Body(...)):
)
user_id = payload.get("sub")
user = await User.filter(id=user_id).first()
user = await User.get(id=user_id)
if not user:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="User not found"