async def get_order_status(db: Session = Depends(get_db)): db_status_list = db.query(models.Status).all() status_list = [] for db_status in db_status_list: status_list.append( schemas.Status(status_id=db_status.status_id, status_name=db_status.status_name)) status_response = schemas.StatusListResponse(status="success", totalCount=len(status_list), data=status_list) return status_response
def delete_jobs(job_id: int, db: Session = Depends(get_db)): delete_status = crud.delete_job(db=db, job_id=job_id) if delete_status: return schemas.Status(message=f"Deleted job {job_id}") return schemas.Status(message=f"Job {job_id} not found")
def apply_for_job(job_id: int, db: Session = Depends(get_db)): job_data = crud.get_job_by_id(db=db, job_id=job_id) if job_data: return schemas.Status(message=f"Applyed for job {job_id}") return schemas.Status(message=f"Job {job_id} not found")
async def delete_user(user_id: int): deleted_count = await User.filter(id=user_id).delete() if not deleted_count: raise HTTPException(status_code=404, detail=f"User {user_id} not found") return schemas.Status(message=f"Deleted user {user_id}")