def addNewProperty(): return PropertyController.addNewProperty(request.form)
def rentProperty(): return PropertyController.rentProperty(request.form)
def getPropertiesRentedByUser(username): return PropertyController.getRenterProperties(username)
def getVendorProperties(username): return PropertyController.getVendorProperties(username)
def getAll(): return PropertyController.getAllAvailableProperties()
def getById(id): #An ObjectId is not the same as its string representation return PropertyController.get(ObjectId(id))
from Controllers.PropertyController import PropertyController from Services.UserService import UserService from Models.User import User app = Flask(__name__) CORS(app) app.secret_key = "air bnb lite" app.config['MONGO_DBNAME'] = 'airbnblite' app.config['MONGO_URI'] = 'mongodb://localhost:27017/airbnblite' mongo = PyMongo(app) UserService = UserService() User = User() UserController = UserController() PropertyController = PropertyController() SessionService = LoginManager() SessionService.init_app(app) #Authentication setup @SessionService.user_loader def user_loader(username): if not UserService.isUser(username): return user = User user.id = username return user @SessionService.request_loader def request_loader(request): if not request.form: