Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeEmacs
title에디터 설정
'documentComparison.config': {
        'list': { // 저장된 문서 목록 리스트에 대한 config 설정입니다.
            'url': '/getDocumentVersionList',
            'headers': {},
            'params': {}
        },
        'data': { // 저장된 문서 목록 중 하나의 데이터에 대한 config 설정입니다.
            'url': '/getDocumentVersionData', 
            'headers': {},
            'params': {},
            'paramKey': ''
        }
    }


API 예제 코드

Code Block
languagejs
themeEmacs
title에디터 설정
    /**
     * 문서 버전 목록 가져오기
     */
    getDocumentVersionList: async (req, res) => {
        const id = _.get(req, ['body', 'id']);
        const results = await versionQueryManager.getVersions(id);

        const formattedData = results.map((result, index) => {
            return {
                id: result._id,
                date: result.createdAt,
                author: '' // 작성자 정보 값 설정
            };
        });
        res.json(formattedData);
    },

    /**
     * 문서 버전 데이터 가져오기
     */
    getDocumentVersionData: async (req, res) => {
        const id = _.get(req, ['body', 'id']);
        const result = await versionQueryManager.getData(id);
        res.json(result.json);
    },