CJVT updates August and September 2026

This commit is contained in:
Luka Romih
2026-10-01 00:49:26 +02:00
parent fd02e25719
commit 83f73aeb58
135 changed files with 6146 additions and 1970 deletions
@@ -1,4 +1,5 @@
const xss = require('xss')
const db = require('../../db')
const { removeHtmlTags } = require('../../helpers')
const { searchEngineClient, ENTRY_INDEX } = require('../../search-engine')
const { DATA_FILES_PATH } = require('../../../config/settings')
@@ -353,3 +354,35 @@ exports.sanitizeField = {
return sanitize(string, markupFilter.mixedOther)
}
}
// Insert a single 'suggestion' status entry (as produced by extraction term
// candidates, whether imported directly or from a JSON export of them).
exports.insertSuggestionEntry = async (dbClient, dictionaryId, userId, term, other) => {
term = term ? exports.sanitizeField.toText(term) : null
other = other ? exports.sanitizeField.toText(other) : null
const values = [
dictionaryId,
false,
'suggestion',
term || null,
userId,
null,
null,
null,
null,
[],
null,
null,
null,
[],
other || null,
[],
null,
null,
null
]
const text = `SELECT entry_new (${db.genParamStr(values)})`
await dbClient.query(text, values)
}