Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions backend/app/api/routes/users.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import uuid
from typing import Any

from fastapi import APIRouter, Depends, HTTPException
from fastapi import APIRouter, Depends, HTTPException, BackgroundTasks
from sqlmodel import col, delete, func, select

from app import crud
Expand Down Expand Up @@ -51,7 +51,9 @@ def read_users(session: SessionDep, skip: int = 0, limit: int = 100) -> Any:
@router.post(
"/", dependencies=[Depends(get_current_active_superuser)], response_model=UserPublic
)
def create_user(*, session: SessionDep, user_in: UserCreate) -> Any:
def create_user(
*, session: SessionDep, user_in: UserCreate, background_tasks: BackgroundTasks
) -> Any:
"""
Create new user.
"""
Expand All @@ -67,11 +69,12 @@ def create_user(*, session: SessionDep, user_in: UserCreate) -> Any:
email_data = generate_new_account_email(
email_to=user_in.email, username=user_in.email, password=user_in.password
)
send_email(
background_tasks.add_task(
send_email,
email_to=user_in.email,
subject=email_data.subject,
html_content=email_data.html_content,
)
)
return user


Expand Down
Loading