CJVT updates August and September 2026
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user