Update code in endpoints/people.post.py
This commit is contained in:
parent
972e8377b7
commit
10a63f4b79
17
endpoints/people.post.py
Normal file
17
endpoints/people.post.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# 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)
|
Loading…
x
Reference in New Issue
Block a user