packages/ove-core/src/server/api.js
function (sectionId) {
        let section = server.state.get('sections[' + sectionId + ']');
        if (section.app && section.app.url) {
            log.debug('Flushing application at URL:', section.app.url);
            request.post(section.app.url + '/instances/' + sectionId + '/flush', _handleRequestError);
        }
        server.state.get('groups').forEach(function (e, groupId) {
            if (e.includes(parseInt(sectionId, 10))) {
                // The outcome of this operation is logged within the internal utility method
                if (e.length === 1) {
                    _deleteGroupById(groupId);
                } else {
                    e.splice(e.indexOf(parseInt(sectionId, 10)), 1);
                    server.state.set('groups[' + groupId + ']', e);
                }
            }
        });
        server.state.set('sections[' + sectionId + ']', {});

        server.wss.clients.forEach(function (c) {
            if (c.readyState === Constants.WEBSOCKET_READY) {
                c.safeSend(JSON.stringify({ appId: Constants.APP_NAME, message: { action: Constants.Action.DELETE, id: parseInt(sectionId, 10) } }));
            }
        });
    }
function (sectionId) {
        let section = server.state.get('sections[' + sectionId + ']');
        if (section.app && section.app.url) {
            log.debug('Flushing application at URL:', section.app.url);
            request.post(section.app.url + '/instances/' + sectionId + '/flush', _handleRequestError);
        }
        server.state.get('groups').forEach(function (e, groupId) {
            if (e.includes(parseInt(sectionId, 10))) {
                // The outcome of this operation is logged within the internal utility method
                if (e.length === 1) {
                    _deleteGroupById(groupId);
                } else {
                    e.splice(e.indexOf(parseInt(sectionId, 10)), 1);
                    server.state.set('groups[' + groupId + ']', e);
                }
            }
        });
        server.state.set('sections[' + sectionId + ']', {});

        server.wss.clients.forEach(function (c) {
            if (c.readyState === Constants.WEBSOCKET_READY) {
                c.safeSend(JSON.stringify({ appId: Constants.APP_NAME, message: { action: Constants.Action.DELETE, id: parseInt(sectionId, 10) } }));
            }
        });
    }
function ( sectionId ) { let section = server . state . get ( 'sections[' + sectionId + ']' ) ; if ( section . app && section . app . url ) { log . debug ( 'Flushing application at URL:' , section . app . url ) ; request . post ( section . app . url + '/instances/' + sectionId + '/flush' , _handleRequestError ) ; } server . state . get ( 'groups' ) . forEach ( function ( e , groupId ) { if ( e . includes ( parseInt ( sectionId , 10 ) ) ) { // The outcome of this operation is logged within the internal utility method if ( e . length === 1 ) { _deleteGroupById ( groupId ) ; } else { e . splice ( e . indexOf ( parseInt ( sectionId , 10 ) ) , 1 ) ; server . state . set ( 'groups[' + groupId + ']' , e ) ; } } } ) ; server . state . set ( 'sections[' + sectionId + ']' , { } ) ; server . wss . clients . forEach ( function ( c ) { if ( c . readyState === Constants . WEBSOCKET_READY ) { c . safeSend ( JSON . stringify ( { appId : Constants . APP_NAME , message : { action : Constants . Action . DELETE , id : parseInt ( sectionId , 10 ) } } ) ) ; } } ) ; }
Internal utility function to delete section by a given id. This function is used either to delete all sections belonging to a given space, or to delete a specific section by its id.
Internal utility function to delete section by a given id . This function is used either to delete all sections belonging to a given space or to delete a specific section by its id .