mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 20:49:06 +01:00
wip
This commit is contained in:
parent
095a41fc48
commit
259c934915
@ -11,3 +11,31 @@ export interface ISwSubscription {
|
|||||||
auth: string;
|
auth: string;
|
||||||
publickey: string;
|
publickey: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SwSubscriptionを物理削除します
|
||||||
|
*/
|
||||||
|
export async function deleteSwSubscription(swSubscription: string | mongo.ObjectID | ISwSubscription) {
|
||||||
|
let s: ISwSubscription;
|
||||||
|
|
||||||
|
// Populate
|
||||||
|
if (mongo.ObjectID.prototype.isPrototypeOf(swSubscription)) {
|
||||||
|
s = await SwSubscription.findOne({
|
||||||
|
_id: swSubscription
|
||||||
|
});
|
||||||
|
} else if (typeof swSubscription === 'string') {
|
||||||
|
s = await SwSubscription.findOne({
|
||||||
|
_id: new mongo.ObjectID(swSubscription)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
s = swSubscription as ISwSubscription;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s == null) return;
|
||||||
|
|
||||||
|
// このSwSubscriptionを削除
|
||||||
|
await SwSubscription.remove({
|
||||||
|
_id: s._id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import DriveFolder, { deleteDriveFolder } from './drive-folder';
|
|||||||
import PollVote, { deletePollVote } from './poll-vote';
|
import PollVote, { deletePollVote } from './poll-vote';
|
||||||
import FollowingLog, { deleteFollowingLog } from './following-log';
|
import FollowingLog, { deleteFollowingLog } from './following-log';
|
||||||
import FollowedLog, { deleteFollowedLog } from './followed-log';
|
import FollowedLog, { deleteFollowedLog } from './followed-log';
|
||||||
|
import SwSubscription, { deleteSwSubscription } from './sw-subscription';
|
||||||
|
|
||||||
const User = db.get<IUser>('users');
|
const User = db.get<IUser>('users');
|
||||||
|
|
||||||
@ -239,6 +240,11 @@ export async function deleteUser(user: string | mongo.ObjectID | IUser) {
|
|||||||
await FollowedLog.find({ userId: u._id })
|
await FollowedLog.find({ userId: u._id })
|
||||||
).map(x => deleteFollowedLog(x)));
|
).map(x => deleteFollowedLog(x)));
|
||||||
|
|
||||||
|
// このユーザーのSwSubscriptionをすべて削除
|
||||||
|
await Promise.all((
|
||||||
|
await SwSubscription.find({ userId: u._id })
|
||||||
|
).map(x => deleteSwSubscription(x)));
|
||||||
|
|
||||||
// このユーザーを削除
|
// このユーザーを削除
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user