From b00b491059868cebfa40eef3c44277c29be2872f Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 27 Mar 2025 20:06:39 +0100 Subject: [PATCH] Update code in endpoints/people.delete.py --- endpoints/people.delete.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 endpoints/people.delete.py diff --git a/endpoints/people.delete.py b/endpoints/people.delete.py new file mode 100644 index 0000000..10fc8e2 --- /dev/null +++ b/endpoints/people.delete.py @@ -0,0 +1,19 @@ +# Entity: Person + +from fastapi import APIRouter, Depends, HTTPException, status +from sqlalchemy.orm import Session +from typing import List +from core.database import get_db +from models.person import Person +from schemas.person import PersonSchema +from helpers.person_helpers import delete_people_below_age + +router = APIRouter() + +@router.delete("/people", status_code=200) +async def delete_people_under_age( + age: int = 50, + db: Session = Depends(get_db) +): + deleted_count = delete_people_below_age(db, age) + return {"message": f"Deleted {deleted_count} people below age {age}"} \ No newline at end of file