Example #1
0
 def __init__(self, sqft, lotSize, askingPrice, appraisalValue, description,
              beds, baths, units):
     Property.__init__(self, sqft, lotSize, askingPrice, appraisalValue,
                       description)
     self.beds = beds
     self.baths = baths
     self.units = units
 def __init__(
     self, name, label, property_type, select_data=None, description=None,
     optional=False, hidden=False, editable=True,
     extra_schema_dict_values=None):
     Property.__init__(
         self, name, label, property_type, select_data=select_data,
         description=description, optional=optional,
         extra_schema_dict_values=extra_schema_dict_values)
     self._hidden = hidden
     self._editable = editable
Example #3
0
def create_apartment():
    """ Add a new apartment for rent """
    apartment: dict = request.get_json()
    startdate: str = apartment.get('startdate')
    enddate: str = apartment.get('enddate')
    latitude: float = apartment.get('latitude')
    longitude: float = apartment.get('longitude')
    country: str = apartment.get('country')
    state: str = apartment.get('state')
    city: str = apartment.get('city')
    address: str = apartment.get('address')
    building_name: str = apartment.get('building_name')
    socialstratum: int = apartment.get('socialstratum')
    price: int = apartment.get('price')
    floor_number: int = apartment.get('floor_number')
    bedroom: int = apartment.get('bedroom')
    bathroom: int = apartment.get('bathroom')
    parkinglot: int = apartment.get('parkinglot')
    mt2: int = apartment.get('mt2')
    description: str = apartment.get('description')
    property_of: int = apartment.get('property_of')
    sector_of: int = apartment.get('sector_of')
    category_of: int = apartment.get('category_of')

    new_apartment: Property = Property(startdate=startdate,
                                       enddate=enddate,
                                       latitude=latitude,
                                       longitude=longitude,
                                       country=country,
                                       state=state,
                                       city=city,
                                       address=address,
                                       building_name=building_name,
                                       socialstratum=socialstratum,
                                       price=price,
                                       floor_number=floor_number,
                                       bedroom=bedroom,
                                       bathroom=bathroom,
                                       parkinglot=parkinglot,
                                       mt2=mt2,
                                       description=description,
                                       property_of=property_of,
                                       sector_of=sector_of,
                                       category_of=category_of)

    db.session.add(new_apartment)
    db.session.commit()

    apartment = new_apartment.query.get(new_apartment.id)

    return make_response(jsonify({'new apartment': apartment.to_dict()})), 200
Example #4
0
 def add_property(self, property: Property):
     property.id = uuid.uuid4()
     self.session.add(property)
     self.session.commit()
     return property