Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Aug 8, 2024
1 parent 36b0c0f commit 4843f30
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 7 additions & 3 deletions app/api/public/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async def update_username(
),
)

response = await users.update_username(user_id, args.new_username)
response = await users.update_username(user_id, new_username=args.new_username)
if isinstance(response, Error):
return JSONResponse(
content=response.model_dump(),
Expand Down Expand Up @@ -105,7 +105,9 @@ async def update_password(
)

response = await users.update_password(
user_id, args.current_password, args.new_password
user_id,
current_password=args.current_password,
new_password=args.new_password,
)
if isinstance(response, Error):
return JSONResponse(
Expand Down Expand Up @@ -140,7 +142,9 @@ async def update_email_address(
)

response = await users.update_email_address(
user_id, args.current_password, args.new_email_address
user_id,
current_password=args.current_password,
new_email_address=args.new_email_address,
)
if isinstance(response, Error):
return JSONResponse(
Expand Down
12 changes: 9 additions & 3 deletions app/usecases/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def fetch_one_by_user_id(user_id: int) -> User | Error:
)


async def update_username(user_id: int, new_username: str) -> None | Error:
async def update_username(user_id: int, *, new_username: str) -> None | Error:
user = await users.fetch_one_by_user_id(user_id)
if user is None:
return Error(
Expand Down Expand Up @@ -138,7 +138,10 @@ async def update_username(user_id: int, new_username: str) -> None | Error:


async def update_password(
user_id: int, current_password: str, new_password: str
user_id: int,
*,
current_password: str,
new_password: str,
) -> None | Error:
user = await users.fetch_one_by_user_id(user_id)
if user is None:
Expand All @@ -158,7 +161,10 @@ async def update_password(


async def update_email_address(
user_id: int, current_password: str, new_email_address: str
user_id: int,
*,
current_password: str,
new_email_address: str,
) -> None | Error:
user = await users.fetch_one_by_user_id(user_id)
if user is None:
Expand Down

0 comments on commit 4843f30

Please sign in to comment.