class BuildingAddition(Resource):

    def __init__(self):
        self.service = PropertyService()

    def post(self):
        """Adding Building Details."""
        data = json.loads(request.data)

        output = self.service.create_building_details(data)
        return output

    def get(self):
        """Building List."""

        # limit = request.args.get("limit", 10)
        # offset = request.args.get("offset", 0)
        # keyword = request.args.get("keyword", "")
        # sort_field = request.args.get("sort_field", "updated_at")

        result = self.service.get_list_building("buildings")

        return result

    def delete(self):
        """ Bulk Delete Building Details """
        data = json.loads(request.data.decode('utf-8'))
        ids = data['ids']

        datastores = self.service.bulk_delete_buildings(ids)
        return datastores
Пример #2
0
class RoomAddition(Resource):
    def __init__(self):
        self.service = PropertyService()

    def post(self, building_id):
        """Add Rooms."""
        data = json.loads(request.data)

        output = self.service.add_room_details(data, building_id)
        return output
Пример #3
0
class Building(Resource):
    def __init__(self):
        self.service = PropertyService()

    def get(self, building_id):
        """ Get  """
        response = self.service.get_building(building_id)
        return response

    def delete(self, building_id):
        """ Delete """
        response = self.service.delete_building(building_id)
        return response

    def put(self, building_id):
        """ Update """
        data = json.loads(request.data.decode('utf-8'))
        # data['updated_at'] = str(datetime.datetime.utcnow())
        update_response = self.service.update_building(data, building_id)
        return update_response
class RoomList(Resource):
    def __init__(self):
        self.service = PropertyService()

    def get(self, building_id):
        """Room List."""

        query = {"building_id": building_id}
        result = self.service.get_list_room("rooms", querydata=query)

        return result
Пример #5
0
 def __init__(self):
     self.service = PropertyService()