mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: various bugs + improve api readability
This commit is contained in:
parent
7daf6df5a0
commit
2bf80030d7
21 changed files with 98 additions and 75 deletions
|
|
@ -104,10 +104,11 @@ async def get_activity(
|
|||
async def update_activity(
|
||||
request: Request,
|
||||
activity_object: ActivityUpdate,
|
||||
activity_id: int,
|
||||
current_user: PublicUser | AnonymousUser,
|
||||
db_session: Session,
|
||||
):
|
||||
statement = select(Activity).where(Activity.id == activity_object.activity_id)
|
||||
statement = select(Activity).where(Activity.id == activity_id)
|
||||
activity = db_session.exec(statement).first()
|
||||
|
||||
if not activity:
|
||||
|
|
@ -121,8 +122,6 @@ async def update_activity(
|
|||
request, activity.activity_uuid, current_user, "update", db_session
|
||||
)
|
||||
|
||||
del activity_object.activity_id
|
||||
|
||||
# Update only the fields that were passed in
|
||||
for var, value in vars(activity_object).items():
|
||||
if value is not None:
|
||||
|
|
@ -183,7 +182,7 @@ async def delete_activity(
|
|||
|
||||
async def get_activities(
|
||||
request: Request,
|
||||
coursechapter_id: str,
|
||||
coursechapter_id: int,
|
||||
current_user: PublicUser | AnonymousUser,
|
||||
db_session: Session,
|
||||
) -> list[ActivityRead]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue