def get(self, labour_id, date): try: current_user = get_jwt_identity() user_data = get_validate_permissions(current_user,["MANAGER","USER"]) if user_data: result = get_labour_by_id_and_date(labour_id,date,user_data) return result else: return {"statusCode":401, "message":"you are not authorized to use this route"},401 except Exception as err: return {"statusCode":400,"message":str(err)},400
def post(self): try: current_user = get_jwt_identity() user_data = get_validate_permissions(current_user,["MANAGER"]) if user_data: result = clear_payments(user_data) return result else: return {"statusCode":401, "message":"you are not authorized to use this route"},401 except Exception as err: return {"statusCode":400, "message":str(err)},400
def get(self,start_date,end_date): try: current_user = get_jwt_identity() user_data = get_validate_permissions(current_user,["FINANCE"]) if user_data: result = get_transactions(start_date,end_date,user_data) return result else: return {"statusCode":401, "message":"you are not authorized to use this route"},401 except Exception as err: return {"statusCode":400, "message":str(err)},400
def post(self): try: req = request.json current_user = get_jwt_identity() user_data = get_validate_permissions(current_user,["USER"]) if user_data: result = payout_labour(req, user_data) return result else: return {"statusCode":401, "message":"you are not authorized to use this route"},401 except Exception as err: return {"statusCode":400, "message":str(err)},400