keloxen-5ipk8i/endpoints/people.post.py
2025-03-28 01:07:34 +00:00

17 lines
515 B
Python

# Entity: Person
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from core.database import get_db
from models.person import Person
from schemas.person import PersonSchema, PersonCreate
from helpers.person_helpers import create_person
router = APIRouter()
@router.post("/people", status_code=201, response_model=PersonSchema)
async def create_new_person(
person: PersonCreate,
db: Session = Depends(get_db)
):
return create_person(db=db, person=person)