(self, sketch_id)
return jsonify(schema)
Handles GET request to the resource.
        Handler for /api/v1/sketches/:sketch_id/event/

        Args:
            sketch_id: Integer primary key for a sketch database model

        Returns:
            JSON of the datastore event
Handles GET request to the resource.
        Handler for /api/v1/sketches/:sketch_id/event/
Handles GET request to the resource . Handler for / api / v1 / sketches / : sketch_id / event /
def get(self, sketch_id):
        """Handles GET request to the resource.
        Handler for /api/v1/sketches/:sketch_id/event/

        Args:
            sketch_id: Integer primary key for a sketch database model

        Returns:
            JSON of the datastore event
        """

        args = self.parser.parse_args()
        sketch = Sketch.query.get_with_acl(sketch_id)
        if not sketch:
            abort(
                HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')
        if not sketch.has_permission(current_user, 'read'):
            abort(HTTP_STATUS_CODE_FORBIDDEN,
                  'User does not have read access controls on sketch.')

        searchindex_id = args.get('searchindex_id')
        searchindex = SearchIndex.query.filter_by(
            index_name=searchindex_id).first()
        if not searchindex:
            abort(
                HTTP_STATUS_CODE_BAD_REQUEST,
                'Search index not found for this event.')
        if searchindex.get_status.status == 'deleted':
            abort(
                HTTP_STATUS_CODE_BAD_REQUEST,
                'Unable to query event on a closed search index.')

        event_id = args.get('event_id')
        indices = [
            t.searchindex.index_name for t in sketch.timelines
            if t.get_status.status.lower() == 'ready']

        # Check if the requested searchindex is part of the sketch
        if searchindex_id not in indices:
            abort(
                HTTP_STATUS_CODE_BAD_REQUEST,
                'Search index ID ({0!s}) does not belong to the list '
                'of indices'.format(searchindex_id))

        result = self.datastore.get_event(searchindex_id, event_id)

        event = Event.query.filter_by(
            sketch=sketch, searchindex=searchindex,
            document_id=event_id).first()

        # Comments for this event
        comments = []
        if event:
            for comment in event.comments:
                if not comment.user:
                    username = 'System'
                else:
                    username = comment.user.username
                comment_dict = {
                    'id': comment.id,
                    'user': {
                        'username': username,
                    },
                    'created_at': comment.created_at,
                    'updated_at': comment.updated_at,
                    'comment': comment.comment
                }
                comments.append(comment_dict)

        schema = {
            'meta': {
                'comments': comments
            },
            'objects': result['_source']
        }
        return jsonify(schema)
def get ( self , sketch_id ) : args = self . parser . parse_args ( ) sketch = Sketch . query . get_with_acl ( sketch_id ) if not sketch : abort ( HTTP_STATUS_CODE_NOT_FOUND , 'No sketch found with this ID.' ) if not sketch . has_permission ( current_user , 'read' ) : abort ( HTTP_STATUS_CODE_FORBIDDEN , 'User does not have read access controls on sketch.' ) searchindex_id = args . get ( 'searchindex_id' ) searchindex = SearchIndex . query . filter_by ( index_name = searchindex_id ) . first ( ) if not searchindex : abort ( HTTP_STATUS_CODE_BAD_REQUEST , 'Search index not found for this event.' ) if searchindex . get_status . status == 'deleted' : abort ( HTTP_STATUS_CODE_BAD_REQUEST , 'Unable to query event on a closed search index.' ) event_id = args . get ( 'event_id' ) indices = [ t . searchindex . index_name for t in sketch . timelines if t . get_status . status . lower ( ) == 'ready' ] # Check if the requested searchindex is part of the sketch if searchindex_id not in indices : abort ( HTTP_STATUS_CODE_BAD_REQUEST , 'Search index ID ({0!s}) does not belong to the list ' 'of indices' . format ( searchindex_id ) ) result = self . datastore . get_event ( searchindex_id , event_id ) event = Event . query . filter_by ( sketch = sketch , searchindex = searchindex , document_id = event_id ) . first ( ) # Comments for this event comments = [ ] if event : for comment in event . comments : if not comment . user : username = 'System' else : username = comment . user . username comment_dict = { 'id' : comment . id , 'user' : { 'username' : username , } , 'created_at' : comment . created_at , 'updated_at' : comment . updated_at , 'comment' : comment . comment } comments . append ( comment_dict ) schema = { 'meta' : { 'comments' : comments } , 'objects' : result [ '_source' ] } return jsonify ( schema )