Skip to content

Commit

Permalink
🐞 fix(api): fix user request field mismatch error
Browse files Browse the repository at this point in the history
  • Loading branch information
centonhuang committed Feb 12, 2024
1 parent 0572e38 commit f500176
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/api/model/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class UserRequest(BaseModel):
user: str
user_name: str
password: str


Expand Down
4 changes: 2 additions & 2 deletions internal/api/router/v1/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def register_user(request: UserRequest) -> StandardResponse:
else:
conn.commit()

user = UserSchema(user_name=request.user, password=request.password)
user = UserSchema(user_name=request.user_name, password=request.password)
conn.add(user)
conn.commit()

Expand All @@ -48,7 +48,7 @@ def login_user(request: UserRequest) -> StandardResponse:
conn.commit()

query = (
conn.query(UserSchema.uid, UserSchema.is_admin).filter(UserSchema.user_name == request.user).filter(UserSchema.password == request.password)
conn.query(UserSchema.uid, UserSchema.is_admin).filter(UserSchema.user_name == request.user_name).filter(UserSchema.password == request.password)
)
result = query.first()

Expand Down

0 comments on commit f500176

Please sign in to comment.