物理削除系の処理を削除
これらの処理はパフォーマンス的に現実的でないし、すべてのモデルの関係を把握している必要があり保守が困難 論理削除でなんとかする
This commit is contained in:
parent
d64dc45899
commit
108dcb3e61
20 changed files with 12 additions and 779 deletions
|
|
@ -33,33 +33,6 @@ export const validateReaction = $.str.or([
|
|||
'pudding'
|
||||
]);
|
||||
|
||||
/**
|
||||
* NoteReactionを物理削除します
|
||||
*/
|
||||
export async function deleteNoteReaction(noteReaction: string | mongo.ObjectID | INoteReaction) {
|
||||
let n: INoteReaction;
|
||||
|
||||
// Populate
|
||||
if (isObjectId(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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue