def get(self, other_user_id): parser = reqparse.RequestParser() parser.add_argument("x-access-token", location='headers', required=True, help='Missing user token!') args = parser.parse_args() uuid1 = AuthSender.get_uuid_from_token(args['x-access-token']) UsersDAO.check_exists(uuid1) UsersDAO.check_exists(other_user_id) msgs = ChatsDAO.get_messages_between(uuid1, other_user_id) self.logger.info(f"Found {len(msgs)} messages between users {uuid1, other_user_id}. RESPONSECODE:200") return msgs, 200
def get_videos_by(cls, user_id, viewer_uuid, token): cls.logger().info(f"Grabbing all videos by user {user_id}") UsersDAO.check_exists(user_id) videos = [ v.serialize() for v in Video.query.filter(Video.uuid == user_id) ] cls.logger().info( f"Filtering by viewable videos for viewer {viewer_uuid}") filtered = [ f for f in videos if not cls._cant_view(f["is_private"], viewer_uuid, user_id) ] for f in filtered: cls.add_extra_info(f, viewer_uuid) f["author"] = AuthSender.get_author_name(f["uuid"], token) cls.logger().info( f"Found {len(filtered)} viewable videos uploaded by user {user_id}" ) return filtered