mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
Update: UserCreate installation model to fix parameter runtime errors.
This commit is contained in:
parent
b07b4500fa
commit
6d76a6f19b
4 changed files with 14 additions and 17 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from typing import Optional
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, EmailStr
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from src.db.roles import RoleRead
|
||||
|
|
@ -10,12 +10,14 @@ class UserBase(SQLModel):
|
|||
username: str
|
||||
first_name: str
|
||||
last_name: str
|
||||
email: str
|
||||
email: EmailStr
|
||||
avatar_image: Optional[str] = ""
|
||||
bio: Optional[str] = ""
|
||||
|
||||
|
||||
class UserCreate(UserBase):
|
||||
first_name: str = ""
|
||||
last_name: str = ""
|
||||
password: str
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -41,33 +41,30 @@ async def api_get_latest_install_instance(
|
|||
|
||||
@router.post("/default_elements")
|
||||
async def api_install_def_elements(
|
||||
request: Request,
|
||||
db_session=Depends(get_db_session),
|
||||
):
|
||||
elements = await install_default_elements(request, {}, db_session)
|
||||
elements = await install_default_elements(db_session)
|
||||
|
||||
return elements
|
||||
|
||||
|
||||
@router.post("/org")
|
||||
async def api_install_org(
|
||||
request: Request,
|
||||
org: OrganizationCreate,
|
||||
db_session=Depends(get_db_session),
|
||||
org: OrganizationCreate,
|
||||
db_session=Depends(get_db_session),
|
||||
):
|
||||
organization = await install_create_organization(request, org, db_session)
|
||||
organization = await install_create_organization(org, db_session)
|
||||
|
||||
return organization
|
||||
|
||||
|
||||
@router.post("/user")
|
||||
async def api_install_user(
|
||||
request: Request,
|
||||
data: UserCreate,
|
||||
org_slug: str,
|
||||
db_session=Depends(get_db_session),
|
||||
):
|
||||
user = await install_create_organization_user(request, data, org_slug, db_session)
|
||||
user = await install_create_organization_user(data, org_slug, db_session)
|
||||
|
||||
return user
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue