def getUsers(): if request.method == 'POST': userDic = {} userDic['uname'] = request.args.get ('uname') userDic['ulast'] = request.args.get ('ulast') userDic['utype'] = request.args.get ('utype') userAddressDic = {} userAddressDic['uaddress'] = request.args.get ('uaddress') userAddressDic['ucity'] = request.args.get ('ucity') userAddressDic['uregion'] = request.args.get ('uregion') userAddressDic['uzip'] = request.args.get ('uzip') userAddressDic['ustate'] = request.args.get ('ustate') userAddressDic['loclat'] = request.args.get ('loclat') userAddressDic['loclon'] = request.args.get ('loclon') return UserHandler().insertUser(userDic,userAddressDic) elif request.method == 'PUT': userDic = {} userDic['uid'] = request.args.get ('uid') userDic['uname'] = request.args.get ('uname') userDic['ulast'] = request.args.get ('ulast') userDic['utype'] = request.args.get ('utype') userAddressDic = {} userAddressDic['uaddress'] = request.args.get ('uaddress') userAddressDic['ucity'] = request.args.get ('ucity') userAddressDic['uregion'] = request.args.get ('uregion') userAddressDic['uzip'] = request.args.get ('uzip') userAddressDic['ustate'] = request.args.get ('ustate') userAddressDic['loclat'] = request.args.get ('loclat') userAddressDic['loclon'] = request.args.get ('loclon') return UserHandler().updateUser(userDic,userAddressDic) elif request.method == 'DELETE': uid = request.args.get ('uid') return UserHandler ().deleteUser (uid) else: if not request.args: return UserHandler().getAllUsers() else: return UserHandler().searchUsers(request.args)
def getSupplierById(uid): return UserHandler ().getSupplierById (uid)
def getAllSuppliers(): return UserHandler ().getAllSuppliers ()
def getCustomerById(uid): return UserHandler ().getCustomerById (uid)
def getAllCustomers(): return UserHandler ().getAllCustomers ()
def getUserById(uid): return UserHandler ().getUserById (uid)
def getResourcesBySupplierId(uid): return UserHandler ().getResourcesBySupplierId(uid)
def getInformationOfUserById(uid): return UserHandler().getInformationOfUserById(uid)
def getInformationOfUserByUsername(username): return UserHandler().getInformationOfUserByUsername(username)
def users(): handler = UserHandler() return handler.getAllUsers()
def getNumberMessagesByUserId(uid): return UserHandler().getNumberMessagesByUserId(uid)
def getAllChatsByUserId(uid): return UserHandler().getAllChatsByUserId(uid)
def register(): if request.method =='POST': return UserHandler().insertUser(request.get_json('data'))
def login(): if request.method == 'POST': return UserHandler().getCredentials(request.get_json('data'))