fix: use deleteMany for models where accountId is not unique when deleting account
All checks were successful
Build / build (18) (pull_request) Successful in 39s
Build / build (20) (push) Successful in 37s
Build / build (18) (push) Successful in 1m11s
Build / build (22) (push) Successful in 1m20s
Build / build (20) (pull_request) Successful in 1m6s
Build / build (22) (pull_request) Successful in 35s

This commit is contained in:
Sainan 2025-03-22 20:45:52 +01:00
parent 57786bfffb
commit 7a3d442ba8

View File

@ -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();