def get(self): data = _property_parser.parse_args() location = None if data["location"] == None else data["location"] kind = None if data["type"] == None else data["type"] price_min = None if data["price_min"] == None else data["price_min"] price_max = None if data["price_max"] == None else data["price_max"] sale = None if data["sale"] == None else data["sale"] address = None if data["address"] == None else data["address"] bathrooms = None if data["bathrooms"] == None else data["bathrooms"] rooms = None if data["rooms"] == None else data["rooms"] furnished = None if data["furnished"] == None else data["furnished"] properties = Property.search(location, kind, price_min, price_max, sale, address, bathrooms, rooms, furnished) return properties
def new_property(init_db, new_user, new_category, new_type): """ New property fixture """ new_user.save() new_category.save() new_type.save() return Property(user_id=new_user.id, category_id=new_category.id, type_id=new_type.id, title='test property', address="test address", longitude=123.4456, latitude=-345.1233, guests=2, beds=2, baths=2, garages=1, price=10000, images=[], is_published=True)
def delete(self): data = _property_parser.parse_args() is_deleted = Property.delete(data["property_id"]) return jsonify({'success': is_deleted})
def put(self): data = _property_parser.parse_args() files = request.files.getlist('files[]') update = Property.update(files=files, **data) return jsonify({'success': update})