2019-06-01 04:02:33 +08:00
|
|
|
import Note from '/imports/api/note';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
export default function updateNote(noteId, revs) {
|
|
|
|
check(noteId, String);
|
|
|
|
check(revs, Number);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
noteId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
revs,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-27 00:23:57 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = Note.update(selector, modifier, { multi: true });
|
2019-06-01 04:02:33 +08:00
|
|
|
|
2020-11-27 00:23:57 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.verbose('Notes: update note pad', { pad: noteId, revs });
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error('Notes: error when updating note pad', { err });
|
|
|
|
}
|
2019-06-01 04:02:33 +08:00
|
|
|
}
|