def create_account(username, phone, mail, password, **kwargs): sess = kwargs.get('sess') user_query = UserMapper(sess) res = user_query.insert_user(username, phone, mail, password) sess.commit() return res
def get_current_user(): try: user = User.objects.get(id=g.user['id']) return UserMapper.to_web_dto(user), 200 except User.DoesNotExist: return {}, 404
def get_account_info(user_id, **kwargs): sess = kwargs.get('sess') user_query = UserMapper(sess) user_info = user_query.query_user_by_id(user_id) return dict_of(user_info)
def get_user_details(user_id): try: user = User.objects.get(Q(username=user_id)) return UserMapper.to_web_dto(user), 200 except User.DoesNotExist: return {}, 404