fix: update delete_post endpoint to include db dependency and add initial tests for main route
All checks were successful
Build and Push to Private Registry / build (push) Successful in 9s
All checks were successful
Build and Push to Private Registry / build (push) Successful in 9s
This commit is contained in:
4
papi.py
4
papi.py
@@ -92,8 +92,8 @@ async def update_post(id: str, post: dict,db: Session = Depends(get_db)):
|
||||
db.refresh(db_post)
|
||||
return {"message":"Post updated successfully","post":db_post}
|
||||
|
||||
@app.delete("/posts/{id}",db: Session = Depends(get_db))
|
||||
async def delete_post(id: str, post: dict):
|
||||
@app.delete("/posts/{id}")
|
||||
async def delete_post(id: str, post: dict,db: Session = Depends(get_db)):
|
||||
db_post = db.query(Post).filter(Post.id == id).first()
|
||||
db.delete(db_post)
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user