feat: add response models to endpoints

This commit is contained in:
swve 2023-11-28 20:49:20 +01:00
parent 7738316200
commit 71279a1294
20 changed files with 148 additions and 68 deletions

View file

@ -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)