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
|
|
@ -38,6 +38,8 @@ async def get_organization(
|
|||
# RBAC check
|
||||
await rbac_check(request, org.org_uuid, current_user, "read", db_session)
|
||||
|
||||
org = OrganizationRead.from_orm(org)
|
||||
|
||||
return org
|
||||
|
||||
|
||||
|
|
@ -61,6 +63,8 @@ async def get_organization_by_slug(
|
|||
# RBAC check
|
||||
await rbac_check(request, org.org_uuid, current_user, "read", db_session)
|
||||
|
||||
org = OrganizationRead.from_orm(org)
|
||||
|
||||
return org
|
||||
|
||||
|
||||
|
|
@ -160,6 +164,8 @@ async def update_org(
|
|||
db_session.commit()
|
||||
db_session.refresh(org)
|
||||
|
||||
org = OrganizationRead.from_orm(org)
|
||||
|
||||
return org
|
||||
|
||||
|
||||
|
|
@ -197,6 +203,7 @@ async def update_org_logo(
|
|||
db_session.commit()
|
||||
db_session.refresh(org)
|
||||
|
||||
|
||||
return {"detail": "Logo updated"}
|
||||
|
||||
|
||||
|
|
@ -244,7 +251,7 @@ async def get_orgs_by_user(
|
|||
user_id: str,
|
||||
page: int = 1,
|
||||
limit: int = 10,
|
||||
):
|
||||
) -> list[Organization]:
|
||||
statement = (
|
||||
select(Organization)
|
||||
.join(UserOrganization)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue