dataeditor api endpoints

This commit is contained in:
mrfry 2021-02-21 14:47:55 +01:00
parent 3e4fda9974
commit 5ca0abbabf
8 changed files with 373 additions and 116 deletions

View file

@ -268,7 +268,7 @@ function processIncomingRequestUsingDb(
})
}
function isQuestionValid(question: Question) {
export function isQuestionValid(question: Question): Boolean {
if (!question.Q) {
return false
}

View file

@ -619,6 +619,8 @@ if (!isMainThread) {
// )
} else if (msg.type === 'update') {
qdbs = msg.qdbs
logger.DebugLog(`Worker update ${workerIndex}`, 'worker update', 1)
// console.log(`[THREAD #${workerIndex}]: update`)
} else if (msg.type === 'newdb') {
qdbs.push(msg.newdb)

View file

@ -375,6 +375,9 @@ function C(color?: string): string {
if (color === 'bluebg') {
return '\x1b[44m'
}
if (color === 'cyanbg') {
return '\x1b[46m'
}
if (color === 'green') {
return '\x1b[32m'
}

View file

@ -11,6 +11,7 @@ export default {
CopyFile,
GetDateString,
formatUrl,
deleteFile: deleteFile,
}
import fs from 'fs'
@ -162,3 +163,11 @@ function AppendToFile(data: string, file: string): void {
console.error(err)
}
}
function deleteFile(fname: string): Boolean {
if (FileExists(fname)) {
fs.unlinkSync(fname)
return true
}
return false
}