bug fixed: numbering the topic and tutorial files
This commit is contained in:
1 parent
03dd8dd980
commit
030db26ae2
7 files changed
+109
-7
No files matched your search
+19
-7
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user