mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add response models to endpoints
This commit is contained in:
parent
7738316200
commit
71279a1294
20 changed files with 148 additions and 68 deletions
|
|
@ -96,6 +96,8 @@ async def get_activity(
|
|||
# RBAC check
|
||||
await rbac_check(request, activity.activity_uuid, current_user, "read", db_session)
|
||||
|
||||
activity = ActivityRead.from_orm(activity)
|
||||
|
||||
return activity
|
||||
|
||||
|
||||
|
|
@ -130,6 +132,8 @@ async def update_activity(
|
|||
db_session.commit()
|
||||
db_session.refresh(activity)
|
||||
|
||||
activity = ActivityRead.from_orm(activity)
|
||||
|
||||
return activity
|
||||
|
||||
|
||||
|
|
@ -182,7 +186,7 @@ async def get_activities(
|
|||
coursechapter_id: str,
|
||||
current_user: PublicUser | AnonymousUser,
|
||||
db_session: Session,
|
||||
):
|
||||
) -> list[ActivityRead]:
|
||||
statement = select(ChapterActivity).where(
|
||||
ChapterActivity.chapter_id == coursechapter_id
|
||||
)
|
||||
|
|
@ -197,6 +201,8 @@ async def get_activities(
|
|||
# RBAC check
|
||||
await rbac_check(request, "activity_x", current_user, "read", db_session)
|
||||
|
||||
activities = [ActivityRead.from_orm(activity) for activity in activities]
|
||||
|
||||
return activities
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue