Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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