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
|
|
@ -118,10 +118,11 @@ async def create_org(
|
|||
async def update_org(
|
||||
request: Request,
|
||||
org_object: OrganizationUpdate,
|
||||
org_id: int,
|
||||
current_user: PublicUser | AnonymousUser,
|
||||
db_session: Session,
|
||||
):
|
||||
statement = select(Organization).where(Organization.id == org_object.org_id)
|
||||
statement = select(Organization).where(Organization.id == org_id)
|
||||
result = db_session.exec(statement)
|
||||
|
||||
org = result.first()
|
||||
|
|
@ -149,9 +150,6 @@ async def update_org(
|
|||
detail="Organization slug already exists",
|
||||
)
|
||||
|
||||
# Remove the org_id from the org_object
|
||||
del org_object.org_id
|
||||
|
||||
# Update only the fields that were passed in
|
||||
for var, value in vars(org_object).items():
|
||||
if value is not None:
|
||||
|
|
@ -203,7 +201,6 @@ async def update_org_logo(
|
|||
db_session.commit()
|
||||
db_session.refresh(org)
|
||||
|
||||
|
||||
return {"detail": "Logo updated"}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue