Beispiel #1
0
    def get(self, _to):
        messages = MessageModel.find_all(_to)
        counter = Counter.find_counter(_to)
        count = 0
        if counter is not None:
            count = counter.count
        all = []
        if messages:
            # TODO: FIX THIS TO SEND DATE TIME
            all = [m.json() for m in messages]

        return {'messages': all, 'count': count}, 200
Beispiel #2
0
 def get(self):
     messages=[]
     args=reqparse.request.args
     if args:
         if  'application_id' in args:
             messages= MessageModel.find_by_app_id(args['application_id'])
         elif 'session_id' in args:
              messages = MessageModel.find_by_session_id(args['session_id'])
         else:
               return {'method not allowed': 'this url is not exists'}, 404
     else:
           messages = MessageModel.find_all()
     if messages:
         return {'message': [message.json() for message in messages]}, 200
     return {'message': 'No messages found!'}, 404
Beispiel #3
0
    def get(self):
        people = PeopleModel.find_all()
        people = [person.person for person in people]

        messages = MessageModel.find_all()
        headers = {'Content-Type': 'text/html'}
        matrices = DrawingModel.find_all()
        for i in matrices:
            print(i.json())
        return make_response(render_template('home.html',
                                             people=people,
                                             messages=messages,
                                             title="DistancePi",
                                             matrices=DrawingModel.find_all()
                                             ),
                             200,
                             headers
                             )