Nodes and Topics at http interface
This commit is contained in:
1 parent
b869b1459e
commit
8cd724fe93
2 files changed
+28
-10
No files matched your search
+26
-8
@@ -311,16 +311,25 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
try {
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestParameters[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
fs.rmdirSync(filePath, { recursive: true })
|
||||
fs.mkdirSync(filePath)
|
||||
|
||||
for (let i = 0; i < docsSchema.length; i++) {
|
||||
let schemaDocument = docsSchema[i]
|
||||
let fileContent = JSON.stringify(schemaDocument)
|
||||
let fileName = schemaDocument.type.toLowerCase().replaceAll(' ', '-') + '.json'
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Nodes'
|
||||
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
|
||||
|
||||
let fileName = schemaDocument.type.toLowerCase()
|
||||
for (let j = 0; j < 10; j++) {
|
||||
fileName = fileName.replace(' ', '-')
|
||||
}
|
||||
fileName = fileName + '.json'
|
||||
|
||||
fs.writeFileSync(filePath + '/' + fileName, fileContent)
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
} catch (err) {
|
||||
@@ -388,16 +397,25 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
try {
|
||||
let docsSchema = JSON.parse(body)
|
||||
let project = requestParameters[3]
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
fs.rmdirSync(filePath, { recursive: true })
|
||||
fs.mkdirSync(filePath)
|
||||
|
||||
for (let i = 0; i < docsSchema.length; i++) {
|
||||
let schemaDocument = docsSchema[i]
|
||||
let fileContent = JSON.stringify(schemaDocument)
|
||||
let fileName = schemaDocument.type.toLowerCase().replaceAll(' ', '-') + '.json'
|
||||
let filePath = global.env.PATH_TO_PROJECTS + '/' + project + '/Schemas/Docs-Topics'
|
||||
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
|
||||
|
||||
let fileName = schemaDocument.type.toLowerCase()
|
||||
for (let j = 0; j < 10; j++) {
|
||||
fileName = fileName.replace(' ', '-')
|
||||
}
|
||||
fileName = fileName + '.json'
|
||||
|
||||
fs.writeFileSync(filePath + '/' + fileName, fileContent)
|
||||
}
|
||||
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
|
||||
} catch (err) {
|
||||
|
||||
@@ -1014,11 +1014,11 @@ function newSuperalgosDocSpace() {
|
||||
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema
|
||||
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Concept-Schema/' + project, onResponse)
|
||||
requestsSent++
|
||||
/*
|
||||
|
||||
docsSchema = SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema
|
||||
httpRequest(JSON.stringify(docsSchema), 'Docs/Save-Topic-Schema/' + project, onResponse)
|
||||
requestsSent++
|
||||
*/ }
|
||||
}
|
||||
|
||||
function onResponse(err, data) {
|
||||
/* Lets check the result of the call through the http interface */
|
||||
|
||||
Reference in new issue
Block a user