mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add courses index page + backend update
This commit is contained in:
parent
86fdd89b23
commit
4b623ae1b8
14 changed files with 218 additions and 50 deletions
|
|
@ -22,6 +22,13 @@ class OrganizationInDB(Organization):
|
|||
org_id: str
|
||||
owners: List[str]
|
||||
admins: List[str]
|
||||
|
||||
class PublicOrganization(Organization):
|
||||
name: str
|
||||
description: str
|
||||
email: str
|
||||
slug: str
|
||||
org_id: str
|
||||
|
||||
|
||||
#### Classes ####################################################
|
||||
|
|
@ -37,7 +44,20 @@ async def get_organization(org_id: str):
|
|||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT, detail="Organization does not exist")
|
||||
|
||||
org = Organization(**org)
|
||||
org = PublicOrganization(**org)
|
||||
return org
|
||||
|
||||
async def get_organization_by_slug(org_slug: str):
|
||||
await check_database()
|
||||
orgs = learnhouseDB["organizations"]
|
||||
|
||||
org = orgs.find_one({"slug": org_slug})
|
||||
|
||||
if not org:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT, detail="Organization does not exist")
|
||||
|
||||
org = PublicOrganization(**org)
|
||||
return org
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue