Update code in endpoints/developers.delete.py
This commit is contained in:
parent
f4d063576e
commit
ce535db257
16
endpoints/developers.delete.py
Normal file
16
endpoints/developers.delete.py
Normal 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))
|
Loading…
x
Reference in New Issue
Block a user