def lease_complete(province, houseId): leaseService = zookeeper.get_service("lease-service") if leaseService: leaseManager = RequestManager(request, leaseService) return leaseManager.post_html("/lease/v1/LeaseComplete/" + province + "/" + str(houseId)) return Response(response="Error: Lease Not Available", status=503)
def create_rental_unit_location(province, houseId): houseService = zookeeper.get_service("house-service") if houseService: houseManager = RequestManager(request, houseService) return houseManager.post_html("/house/v1/RentalUnitLocation/" + province + "/" + str(houseId)) return Response(response="Error: House Not Available", status=503)
def house_complete(houseId): houseService = zookeeper.get_service("house-service") if houseService: houseManager = RequestManager(request, houseService) return houseManager.post_html("/house/v1/HouseComplete/" + str(houseId)) return Response(response="Error: House Service Currently Unavailable", status=503)
def create_homeowner_location(province, arrangement, homeownerId, houseId): houseService = zookeeper.get_service("house-service") if houseService: houseManager = RequestManager(request, houseService) return houseManager.post_html("/house/v1/HomeownerLocation/" + province + "/" + arrangement + "/" + str(homeownerId) + "/" + str(houseId)) return Response(response="Error: House Not Available", status=503)
def create_arrangement(): homeownerService = zookeeper.get_service("homeowner-service") if homeownerService: headers = {"Authorization": "Bearer " + request.form.get("token")} homeownerManager = RequestManager(request, homeownerService) homeownerId = homeownerManager.authenticate(headers=headers) if homeownerId: houseService = zookeeper.get_service("house-service") if houseService: houseManager = RequestManager(request, houseService) return houseManager.post_html("/house/v1/House/" + str(homeownerId), headers=headers) return Response( response="Error: House Service Currently Unavailable", status=503) return Response(response="Not Authorized", status=401) return Response(response="Error: Homeowner Not Available", status=503)
def create_rent_details(province, houseId): homeownerService = zookeeper.get_service("homeowner-service") if homeownerService: headers = {"Authorization": "Bearer " + request.form.get("token")} homeownerManager = RequestManager(request, homeownerService) homeownerId = homeownerManager.authenticate(headers=headers) if homeownerId: leaseService = zookeeper.get_service("lease-service") if leaseService: leaseManager = RequestManager(request, leaseService) return leaseManager.post_html("/lease/v1/RentDetails/" + province + "/" + str(houseId), headers=headers) return Response( response="Error: House Service Currently Unavailable", status=503) return Response(response="Not Authorized", status=401) return Response(response="Error: Lease Not Available", status=503)
def create_homeowner_account(): service = zookeeper.get_service("homeowner-service") if service: manager = RequestManager(request, service) return manager.post_html("/homeowner/v1/") return Response(response="Error: Zookeeper down", status=503)