Dealer_Onboarding_Backend/scripts/remove_abhishek_app.ts

37 lines
880 B
TypeScript

import dotenv from 'dotenv';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
dotenv.config({ path: path.join(__dirname, '../.env') });
import db from '../src/database/models/index.js';
async function run() {
try {
const appId = '1f1fec7d-7034-4588-a4b2-0e1d4cc3f149';
const abhishekId = '9284a190-f4d2-49f3-9186-bb7c93dc9b6d';
const deleted = await db.RequestParticipant.destroy({
where: {
requestId: appId,
userId: abhishekId
}
});
if (deleted) {
console.log('Successfully removed Abhishek from application participants.');
} else {
console.log('Abhishek was not found in participants for this application.');
}
process.exit(0);
} catch (error) {
console.error('Error:', error);
process.exit(1);
}
}
run();