mizzkey/src/server/api/common/getters.ts
MeiMei 22830965e3 AP Undo Like (#3933)
* AP Undo Like

* rename
2019-01-20 03:07:12 +09:00

19 lines
340 B
TypeScript

import * as mongo from 'mongodb';
import Note from "../../../models/note";
/**
* Get valied note for API processing
*/
export async function getValiedNote(noteId: mongo.ObjectID) {
const note = await Note.findOne({
_id: noteId,
deletedAt: { $exists: false }
});
if (note === null) {
throw 'note not found';
}
return note;
}