Exemplo n.º 1
0
 def get(self):
     logger.info('{} get method'.format(self.__class__ ))
     request_json = request.json
     room_id = request_json['room_id']
     messages = Message.get_by_roomid(room_id)
     response = jsonify({"messages":messages})
     return response
Exemplo n.º 2
0
 def post(self):
     logger.info('{} post method'.format(self.__class__))
     request_json = request.json
     like = Like(request_json['user_id'], request_json['message_id'])
     likeid = like.add()
     if isinstance(likeid, chatroomORMException):
         return make_response(jsonify(likeid.__str__()), 400)
     return likeid, 201
Exemplo n.º 3
0
 def post(self):
     logger.info('{} post method'.format(self.__class__ ))
     request_json = request.json
     content = request_json['room']
     room_name = content['name']
     newroom = Room(room_name)
     roomid = newroom.add()
     return roomid, 201
Exemplo n.º 4
0
 def post(self):
     logger.info('{} post method'.format(self.__class__))
     request_json = request.json
     content = request_json['message']
     newmsg = Message(content['content'], content['room_id'])
     msgid = newmsg.add()
     if isinstance(msgid, chatroomORMException):
         return make_response(jsonify(msgid.__str__()), 400)
     return msgid, 201
Exemplo n.º 5
0
 def get(self):
     logger.info('{} get method'.format(self.__class__ ))
     rooms = Room.get_rooms()
     response = jsonify({"rooms":rooms})
     return response