2020-03-24 19:22:41 +03:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const readline = require('readline')
|
|
|
|
|
|
|
|
const DB = require('../db/DB')
|
|
|
|
|
2022-10-04 19:58:03 +03:00
|
|
|
/**
|
|
|
|
* OBSOLETE
|
|
|
|
* One-off script that deletes a subscriber record from the subscriber table
|
|
|
|
*/
|
2020-03-24 19:22:41 +03:00
|
|
|
const rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
});
|
|
|
|
|
|
|
|
(async () => {
|
2022-10-04 19:58:03 +03:00
|
|
|
rl.question('What FXA primary email address? ', firstAnswer => {
|
|
|
|
rl.question('Please re-type the email address to confirm. ', async (secondAnswer) => {
|
|
|
|
if (firstAnswer !== secondAnswer) {
|
2020-03-24 19:22:41 +03:00
|
|
|
console.error('Email addresses do not match.')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
|
2022-10-18 04:51:44 +03:00
|
|
|
const subscriber = await DB.getSubscriberByEmail(secondAnswer)
|
2020-03-24 19:22:41 +03:00
|
|
|
if (!subscriber) {
|
|
|
|
console.error('Could not find subscriber.')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
await DB.deleteEmailAddressesByUid(subscriber.id)
|
2023-05-22 23:12:55 +03:00
|
|
|
await DB.deleteSubscriber(subscriber)
|
2020-03-24 19:22:41 +03:00
|
|
|
console.log('Deleted email_addresses and subscribers records.')
|
|
|
|
process.exit()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})()
|