diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-29 21:06:23 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-29 21:06:23 +0900 |
| commit | 108dcb3e611d833e82c2dc3b8f0ccf5552597bc1 (patch) | |
| tree | 29ffd5409c002985cfe0f97ae23664fc23af7bb9 /src/models/blocking.ts | |
| parent | User blocking (Following part) (#3035) (diff) | |
| download | sharkey-108dcb3e611d833e82c2dc3b8f0ccf5552597bc1.tar.gz sharkey-108dcb3e611d833e82c2dc3b8f0ccf5552597bc1.tar.bz2 sharkey-108dcb3e611d833e82c2dc3b8f0ccf5552597bc1.zip | |
物理削除系の処理を削除
これらの処理はパフォーマンス的に現実的でないし、すべてのモデルの関係を把握している必要があり保守が困難
論理削除でなんとかする
Diffstat (limited to 'src/models/blocking.ts')
| -rw-r--r-- | src/models/blocking.ts | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/models/blocking.ts b/src/models/blocking.ts index 9a6e4ce42d..2974b53554 100644 --- a/src/models/blocking.ts +++ b/src/models/blocking.ts @@ -1,6 +1,5 @@ import * as mongo from 'mongodb'; import db from '../db/mongodb'; -import isObjectId from '../misc/is-objectid'; const Blocking = db.get<IBlocking>('blocking'); Blocking.createIndex(['blockerId', 'blockeeId'], { unique: true }); @@ -12,30 +11,3 @@ export type IBlocking = { blockeeId: mongo.ObjectID; blockerId: mongo.ObjectID; }; - -/** - * Blockingを物理削除します - */ -export async function deleteBlocking(blocking: string | mongo.ObjectID | IBlocking) { - let f: IBlocking; - - // Populate - if (isObjectId(blocking)) { - f = await Blocking.findOne({ - _id: blocking - }); - } else if (typeof blocking === 'string') { - f = await Blocking.findOne({ - _id: new mongo.ObjectID(blocking) - }); - } else { - f = blocking as IBlocking; - } - - if (f == null) return; - - // このBlockingを削除 - await Blocking.remove({ - _id: f._id - }); -} |