Ejemplo n.º 1
0
def delete_education(uid, token):
    education_id = request.values.get('education_id')
    ret = education_action.delete_education(education_id)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 2
0
def update_summary(uid, token):
    summary = request.values.get('summary')
    ret = summary_action.update_user_summary(uid, summary)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 3
0
def delete_experience(uid, token):
    experience_id = request.values.get('experience_id')
    ret = experience_action.delete_experience(experience_id)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 4
0
def insert_experience(uid, token):
    experience = json.loads(request.values.get('experience'))
    ret = experience_action.insert_experience(uid, experience)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 5
0
def insert_education(uid, token):
    education = json.loads(request.values.get('education'))
    ret = education_action.insert_education(uid, education)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 6
0
def update_profile(uid, token):
    profile = json.loads(request.values.get('profile'))
    ret = update_user_profile(uid, profile)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return token_ret(token=token, code=code, success=0, msg=msg)
    else:
        return token_ret(token=token, ret=ret)
Ejemplo n.º 7
0
def search(uid, token):
    keys = request.values.get('keys')
    keys = keys.lower()
    keys = keys.split('+')
    uids = search_action.get_all_uids()
    items = search_action.search_all_uids(keys, uids)
    return token_ret(items=items, token=token)
Ejemplo n.º 8
0
def authentication():
    username = request.values.get('username')
    password = request.values.get('password')
    if not username or not password:
        return failure_ret(code=-100, msg="Missing Parameters")
    ret = authentication_action(username, password)
    code = ret.get('code', 1)
    if code < 0:
        msg = ret.get('msg')
        return failure_ret(code=code, msg=msg)
    else:
        token = ret.get('token')
        return token_ret(token=token, ret=ret, success=1)
Ejemplo n.º 9
0
def user_signup():
    credential_raw = json.loads(request.values.get('credential'))
    profile = json.loads(request.values.get('profile'))

    if not credential_raw or not profile:
        return failure_ret(
            code=-200,
            msg='Parameter error, credential or profile can not be empty')

    credential = {
        'username': credential_raw.get('username'),
        'password': credential_raw.get('password')
    }

    ret = signup(credential, profile)
    code = ret.get('code')
    if code < 0:
        return failure_ret(code=code, msg=ret.get('msg'))
    else:
        token = ret.get('token')
        return token_ret(token=token, ret=ret, success=1)
Ejemplo n.º 10
0
def get_summary(uid, token):
    summary = summary_action.get_sumamry_by_uid_action(uid)
    return token_ret(token=token, success=1, summary=summary)
Ejemplo n.º 11
0
def get_experiences(uid, token):
    experiences = experience_action.get_experiences_by_uid(uid)
    return token_ret(token=token, experiences=experiences)
Ejemplo n.º 12
0
def get_educations(uid, token):
    educations = education_action.get_educations_by_uid(uid)
    return token_ret(token=token, educations=educations)
Ejemplo n.º 13
0
def get_profile(uid, token):
    profile = get_profile_by_uid_action(uid)
    return token_ret(token=token, success=1, profile=profile)