def post_employee():
     try:
         log(f"Creating new employee")
         employee = Employee.json_parse(request.json)
         employee = EmployeeService.create_employee(employee)
         return jsonify(employee.json()), 201
     except ValueError:
         return 'Invalid input', 400
 def post_employee():
     try:
         employee = Employee.json_parse(request.json)
         employee = EmployeeService.add_employee(employee)
         return jsonify(employee.json()), 201
     except KeyError:
         return "Please enter a username.", 400
     except ResourceNotFound as r:
         return r.message, 404
 def put_employees(empid):
     try:
         emp = Employee.json_parse(request.json)
         emp.empid = int(empid)
         EmployeeService.update_employee(emp)
         return jsonify(emp.json()), 200
     except ValueError as e:
         return "Not a valid ID or No such user exist with this ID", 400  # Bad Request
     except ResourceNotFound as r:
         return r.message, 404
 def put_employee(employee_id):
     try:
         log(f"Updating employee info for employee id={employee_id}")
         employee = Employee.json_parse(request.json)
         employee.employee_id = int(employee_id)
         employee = EmployeeService.update_employee(employee)
         return jsonify(employee.json()), 200
     except ResourceNotFound:
         return 'employee id not found', 404
     except ValueError:
         return 'Invalid Input', 201
 def post_employees():
     emp = Employee.json_parse(request.json)
     empserv = EmployeeService.create_employee(emp)
     return jsonify(empserv.json()), 201  # resource created