Ejemplo n.º 1
0
 def get(self):
     try:
         return res_json(res_data_pass(
             service.GetSession().get_user_list()))
     except Exception as e:
         print e
         abort(400)
Ejemplo n.º 2
0
 def get(self, username):
     try:
         return res_json(
             res_data_pass(
                 service.GetSession().get_list_of_contact(username)))
     except Exception as e:
         print e
         abort(400)
Ejemplo n.º 3
0
 def post(self, username):
     try:
         request_json_data = request.get_json()
         if request_json_data:
             if request_json_data.has_key(
                     'name') and request_json_data.has_key('number'):
                 if service.GetSession().add_contact(
                         request_json_data.__getitem__('number'), username,
                         request_json_data.__getitem__('name')):
                     print "dsdsds"
                     if service.GetSession().add_contact_with_user_ref(
                             username,
                             request_json_data.__getitem__('number')):
                         return res_json(res_data_pass("ADDED"))
                 else:
                     return res_json(res_data_fail("ISSUE"))
             else:
                 return res_json(res_data_fail("ISSUE"))
         else:
             return res_json(res_data_fail("ISSUE"))
     except Exception as e:
         print(e)
         abort(400)
Ejemplo n.º 4
0
 def delete(self):
     try:
         request_json_data = request.get_json()
         if request_json_data:
             if request_json_data.has_key('user_name'):
                 if service.GetSession().del_user(
                         request_json_data.__getitem__('user_name')):
                     return res_json(res_data_pass("DELETED"))
                 else:
                     return res_json(res_data_fail("ISSUE"))
             else:
                 return res_json(res_data_fail("ISSUE"))
         else:
             return res_json(res_data_fail("ISSUE"))
     except Exception as e:
         print(e)
         abort(400)
Ejemplo n.º 5
0
 def delete(self, username):
     try:
         request_json_data = request.get_json()
         if request_json_data:
             if request_json_data.has_key(
                     'name') and request_json_data.has_key('number'):
                 if service.GetSession().del_contact(
                         username, request_json_data.__getitem__('name'),
                         request_json_data.__getitem__('number')):
                     return res_json(res_data_pass("DELETED"))
                 else:
                     return res_json(res_data_fail("ISSUE"))
             else:
                 return res_json(res_data_fail("ISSUE"))
         else:
             return res_json(res_data_fail("ISSUE"))
     except Exception as e:
         print(e)
         abort(400)