wip
This commit is contained in:
@@ -16,12 +16,35 @@ export interface INoteReaction {
|
||||
reaction: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* NoteReactionを物理削除します
|
||||
*/
|
||||
export async function deleteNoteReaction(noteReaction: string | mongo.ObjectID | INoteReaction) {
|
||||
let n: INoteReaction;
|
||||
|
||||
// Populate
|
||||
if (mongo.ObjectID.prototype.isPrototypeOf(noteReaction)) {
|
||||
n = await NoteReaction.findOne({
|
||||
_id: noteReaction
|
||||
});
|
||||
} else if (typeof noteReaction === 'string') {
|
||||
n = await NoteReaction.findOne({
|
||||
_id: new mongo.ObjectID(noteReaction)
|
||||
});
|
||||
} else {
|
||||
n = noteReaction as INoteReaction;
|
||||
}
|
||||
|
||||
if (n == null) return;
|
||||
|
||||
// このNoteReactionを削除
|
||||
await NoteReaction.remove({
|
||||
_id: n._id
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack a reaction for API response
|
||||
*
|
||||
* @param {any} reaction
|
||||
* @param {any} me?
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
export const pack = (
|
||||
reaction: any,
|
||||
|
Reference in New Issue
Block a user