diff --git a/Client/httpInterface.js b/Client/httpInterface.js index fa091ad38..409cb13a4 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -313,7 +313,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes' - checkAllSchmemaDocuments(docsSchema, filePath) + checkAllSchmemaDocuments('Node', docsSchema, filePath) respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { @@ -340,7 +340,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Concepts' - checkAllSchmemaDocuments(docsSchema, filePath) + checkAllSchmemaDocuments('Concept', docsSchema, filePath) respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { @@ -367,7 +367,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics' - checkAllSchmemaDocuments(docsSchema, filePath) + checkAllSchmemaDocuments('Topic', docsSchema, filePath) respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { @@ -394,7 +394,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Tutorials' - checkAllSchmemaDocuments(docsSchema, filePath) + checkAllSchmemaDocuments('Tutorial', docsSchema, filePath) respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { @@ -421,7 +421,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE let project = requestParameters[3] let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Books' - checkAllSchmemaDocuments(docsSchema, filePath) + checkAllSchmemaDocuments('Book', docsSchema, filePath) respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse) } catch (err) { @@ -441,7 +441,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } } - function checkAllSchmemaDocuments(docsSchema, filePath) { + function checkAllSchmemaDocuments(category, docsSchema, filePath) { const fs = require('fs') for (let i = 0; i < docsSchema.length; i++) { @@ -450,6 +450,18 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE for (let j = 0; j < 10; j++) { fileName = cleanFileName(fileName) } + let pageNumber = '00' + schemaDocument.pageNumber + + switch (category) { + case 'Topic': { + fileName = schemaDocument.topic.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase() + break + } + case 'Tutorial': { + fileName = schemaDocument.tutorial.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase() + break + } + } fileName = fileName + '.json' if (schemaDocument.deleted === true) { @@ -465,7 +477,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE if (schemaDocument.updated === true || schemaDocument.created === true) { try { let created = schemaDocument.created - let updated = schemaDocument.updated + let updated = schemaDocument.updated schemaDocument.updated = undefined schemaDocument.created = undefined let fileContent = JSON.stringify(schemaDocument, undefined, 4) diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json new file mode 100644 index 000000000..7831e604c --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-001-vaina 1.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "1", + "type": "Vaina 1", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 1", + "updated": 1610381133258 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json new file mode 100644 index 000000000..c0c7f5f7e --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-002-vaina 2.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "2", + "type": "Vaina 2", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 2", + "updated": 1610381139634 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json new file mode 100644 index 000000000..6c899a0d0 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-003-vaina 3.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "3", + "type": "Vaina 3", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 3", + "updated": 1610381169574 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json new file mode 100644 index 000000000..917f6e816 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-004-vaina 4.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "4", + "type": "Vaina 4", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 4", + "updated": 1610381177981 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json new file mode 100644 index 000000000..a2ce337c0 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-005-vaina 5.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "5", + "type": "Vaina 5", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 5", + "updated": 1610381184235 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/vaina-2.5-vaina 2.5.json b/Projects/Superalgos/Schemas/Docs-Topics/vaina-2.5-vaina 2.5.json new file mode 100644 index 000000000..9769c6eef --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/vaina-2.5-vaina 2.5.json @@ -0,0 +1,15 @@ +{ + "topic": "Vaina", + "pageNumber": "2.5", + "type": "Vaina 2.5", + "definition": { + "text": "Write here a summary for this topic page." + }, + "paragraphs": [ + { + "style": "Text", + "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode. 2.5", + "updated": 1610381151723 + } + ] +} \ No newline at end of file