Exemplo n.º 1
0
 def get(self, hobby, start_date, end_date):
     '''Get user's hobby'''
     try:
         resp = User().get_data_by_hobby_between(hobby, start_date, end_date)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 2
0
 def delete(self, userid):
     '''Delete user data by user ID'''
     try:
         resp = User().delete_data_by_userid(userid)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 3
0
 def get(self, hobby, register_after):
     '''Get user's hobby'''
     try:
         resp = User().get_data_by_hobby(hobby, register_after)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 4
0
 def get(self, username):
     '''Get user data by username'''
     try:
         resp = User().get_data_by_username(username)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 5
0
 def post(self):
     '''Add new user'''
     try:
         json_data = api.payload
         resp = User().register(json_data)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 6
0
 def put(self, userid):
     '''Update user data by user ID'''
     try:
         json_data = api.payload
         resp = User().update_data_by_userid(userid, json_data)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 7
0
 def get(self):
     '''Logout and autoamatically revoke current access_token (PS: refresh_token still can be used)'''
     is_valid, code, msg = is_token_valid(
         request.headers.get('Authorization'))
     if is_valid:
         encoded_token = request.headers.get('Authorization').replace(
             'Bearer ', '')
         resp = User().do_logout(encoded_token=encoded_token)
         return masked_json_template(resp, 200)
     else:
         abort(code, msg)
Exemplo n.º 8
0
def do_reg_user():
    app.logger.debug(request)
    # 교회에 해당 아이디를 생서 우편번호화 생성 일자 결합
    #church_id = createChurchId(request.values['zip_code']);

    # 입력반응 사용자 정보 저장
    user = User(request)
    user.insert_user_info()
    # 입력 받은 교회 정보 저장
    #regChruchInfo(request, church_id)
    return render_template('user/welcome.html')
Exemplo n.º 9
0
 def post(self):
     '''Login using Binary Token to get Server Token'''
     try:
         json_data = api.payload
         resp = User().validate_user(json_data=json_data)
         return masked_json_template(resp, 200)
     except:
         resp = get_json_template(response=False,
                                  message="No Json Input Found.",
                                  results=-1,
                                  total=-1)
         return resp, 404
Exemplo n.º 10
0
 def delete(self):
     '''Delete all existing User data'''
     try:
         try:
             get_args = {
                 "filter": request.args.get('filter', default="{}", type=str),
                 "range": request.args.get('range', default="[]", type=str),
                 "sort": request.args.get('sort', default="[]", type=str)
             }
         except:
             get_args = None
         resp = User().delete_all_user_data(get_args)
         return masked_json_template(resp, 200)
     except:
         abort(400, "Input unrecognizable.")
Exemplo n.º 11
0
    def get(self):
        '''Get all user data'''
        try:
            try:
                get_args = {
                    "filter": request.args.get('filter', default="", type=str),
                    "range": request.args.get('range', default="", type=str),
                    "sort": request.args.get('sort', default="", type=str)
                }
            except:
                get_args = None

            resp = User().get_users(get_args)
            if resp["results"] is None:
                resp["results"] = []
            return masked_json_template(resp, 200, no_checking=True)
        except:
            abort(400, "Input unrecognizable.")