Update code in endpoints/developers.delete.py

This commit is contained in:
Backend IM Bot 2025-03-29 12:15:10 +01:00
parent f4d063576e
commit ce535db257

View File

@ -0,0 +1,16 @@
from fastapi import APIRouter, Depends, HTTPException
from core.database import get_db
from sqlalchemy.orm import Session
from models import Developer
router = APIRouter()
@router.delete("/developers")
async def delete_all_developers(db: Session = Depends(get_db)):
"""Delete all developers"""
try:
db.query(Developer).delete()
db.commit()
return {"message": "All developers deleted successfully"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))