From 5817b48db90814efbf8d78acb098fc64de7fe413 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 22 Mar 2025 18:12:59 -0700 Subject: [PATCH] fix: use deleteMany for models where accountId is not unique when deleting account (#1290) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1290 --- src/controllers/custom/deleteAccountController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/custom/deleteAccountController.ts b/src/controllers/custom/deleteAccountController.ts index cb249d69..63ade312 100644 --- a/src/controllers/custom/deleteAccountController.ts +++ b/src/controllers/custom/deleteAccountController.ts @@ -14,12 +14,12 @@ export const deleteAccountController: RequestHandler = async (req, res) => { // TODO: Handle the account being the creator of a guild await Promise.all([ Account.deleteOne({ _id: accountId }), - GuildMember.deleteOne({ accountId: accountId }), + GuildMember.deleteMany({ accountId: accountId }), Inbox.deleteMany({ ownerId: accountId }), Inventory.deleteOne({ accountOwnerId: accountId }), Loadout.deleteOne({ loadoutOwnerId: accountId }), PersonalRooms.deleteOne({ personalRoomsOwnerId: accountId }), - Ship.deleteOne({ ShipOwnerId: accountId }), + Ship.deleteMany({ ShipOwnerId: accountId }), Stats.deleteOne({ accountOwnerId: accountId }) ]); res.end();