mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-13 14:53:08 +02:00
22830965e3
* AP Undo Like * rename
18 lines
340 B
TypeScript
18 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;
|
|
}
|