From eae9f17033baf2b59b0f046bc57ebfbc58aee7b3 Mon Sep 17 00:00:00 2001 From: Behzad-rabiei Date: Tue, 31 Dec 2024 12:01:35 +0100 Subject: [PATCH] format: clean the code --- .../migrations/db/deleteSpecificUserData.ts | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bot/src/migrations/db/deleteSpecificUserData.ts b/bot/src/migrations/db/deleteSpecificUserData.ts index 59e271b..dbc98eb 100644 --- a/bot/src/migrations/db/deleteSpecificUserData.ts +++ b/bot/src/migrations/db/deleteSpecificUserData.ts @@ -1,11 +1,11 @@ -import 'dotenv/config'; +import 'dotenv/config' -import mongoose from 'mongoose'; +import mongoose from 'mongoose' -import { DatabaseManager, Platform, PlatformNames } from '@togethercrew.dev/db'; +import { DatabaseManager, Platform, PlatformNames } from '@togethercrew.dev/db' -import config from '../../config'; -import parentLogger from '../../config/logger'; +import config from '../../config' +import parentLogger from '../../config/logger' const logger = parentLogger.child({ event: 'deleteSpecificUserData' }) @@ -34,20 +34,17 @@ export const up = async () => { const guildConnection = await DatabaseManager.getInstance().getGuildDb(GUILD_ID) - const deleteGuildMemberResult = await guildConnection.models.GuildMember.deleteOne({ + await guildConnection.models.GuildMember.deleteOne({ discordId: USER_ID, }) - const deleteRawInfoResult = await guildConnection.models.RawInfo.deleteMany({ author: USER_ID }) + await guildConnection.models.RawInfo.deleteMany({ author: USER_ID }) - const pullUserMentionsResult = await guildConnection.models.RawInfo.updateMany( + await guildConnection.models.RawInfo.updateMany( { user_mentions: USER_ID }, { $pull: { user_mentions: USER_ID } } ) - const updateRepliedUserResult = await guildConnection.models.RawInfo.updateMany( - { replied_user: USER_ID }, - { $set: { replied_user: null } } - ) + await guildConnection.models.RawInfo.updateMany({ replied_user: USER_ID }, { $set: { replied_user: null } }) await mongoose.connection.close() logger.info('Migration completed and core MongoDB connection closed.') } catch (err) {