🐛 Strict proxy-table field naming
This worked in SQlite3, but threw when using PostgreSQL.
This commit is contained in:
parent
ed30291a4c
commit
9d2e284da3
2 changed files with 6 additions and 2 deletions
|
|
@ -30,7 +30,11 @@ class User(Model):
|
||||||
is_admin: bool = field.BooleanField(default=False)
|
is_admin: bool = field.BooleanField(default=False)
|
||||||
is_staff: bool = field.BooleanField(default=False)
|
is_staff: bool = field.BooleanField(default=False)
|
||||||
groups: field.ManyToManyRelation[Group] = field.ManyToManyField(
|
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:
|
class Schema:
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ async def refresh_token(refresh_token: TokenRefresh = Body(...)):
|
||||||
)
|
)
|
||||||
|
|
||||||
user_id = payload.get("sub")
|
user_id = payload.get("sub")
|
||||||
user = await User.filter(id=user_id).first()
|
user = await User.get(id=user_id)
|
||||||
if not user:
|
if not user:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED, detail="User not found"
|
status_code=status.HTTP_401_UNAUTHORIZED, detail="User not found"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue