mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 14:24:12 +00:00
18 lines
476 B
CoffeeScript
18 lines
476 B
CoffeeScript
db = require("./DB")
|
|
|
|
module.exports = LearnedWordsManager =
|
|
learnWord: (user_token, word, callback = (error)->) ->
|
|
db.spellingPreferences.update {
|
|
token: user_token
|
|
}, {
|
|
$push: learnedWords: word
|
|
}, {
|
|
upsert: true
|
|
}, callback
|
|
|
|
getLearnedWords: (user_token, callback = (error, words)->) ->
|
|
db.spellingPreferences.findOne token: user_token, (error, preferences) ->
|
|
return callback error if error?
|
|
callback null, (preferences?.learnedWords || [])
|
|
|
|
|