25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
497 B

  1. # Routes for user. MAIN PART OF THE API
  2. from fastapi import APIRouter, status
  3. from sqlalchemy.orm import Session
  4. from fastapi import Depends
  5. from schemas.user import UserCreate, ShowUser
  6. from db.session import get_db
  7. from db.repository.user import create_new_user
  8. router = APIRouter()
  9. @router.post("/", response_model=ShowUser, status_code=status.HTTP_201_CREATED)
  10. def create_user(user: UserCreate, db: Session = Depends(get_db)):
  11. user = create_new_user(user=user, db=db)
  12. return user