Esempio n. 1
0
 def get(self, id):
     emp = Employee.find_by_id(id)
     if emp is None:
         return (
             {
                 "msg": "not found",
                 "description": f"Employee with id {id} was not found.",
             },
             404,
         )
     return {"employee": emp.json()}, 200
Esempio n. 2
0
 def delete(self, id):
     emp = Employee.find_by_id(id)
     if emp is None:
         return (
             {
                 "msg": "not found",
                 "description": f"Employee with id {id} was not found.",
             },
             404,
         )
     try:
         emp.remove()
     except Exception as e:
         return {"msg": "Something went wrong", "description": e}, 500
     return {"msg": "employee deleted successfully"}, 200