|
|
@ -85,6 +85,37 @@ module.dvrIngest = async (episodeId) => {
|
|
|
|
module.log.info('job created', { id: job.id });
|
|
|
|
module.log.info('job created', { id: job.id });
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.deleteOtpAccount = async (target) => {
|
|
|
|
|
|
|
|
const { otpAuth: otpAuthService } = module.services;
|
|
|
|
|
|
|
|
const User = mongoose.model('User');
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const user = await User.findOne({ email: target }).lean();
|
|
|
|
|
|
|
|
const response = await otpAuthService.removeForUser(user);
|
|
|
|
|
|
|
|
module.log.info('OTP accounts removed', { userId: user._id, response });
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
module.log.error('failed to remove OTP account', { target, error });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.makeBucket = async (target) => {
|
|
|
|
|
|
|
|
const { minio: minioService } = module.services;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
module.log.info('creating bucket', { target });
|
|
|
|
|
|
|
|
await minioService.makeBucket(target, 'us-east-1');
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
module.log.error('failed to create bucket', { target, error });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.resetIndexes = async ( ) => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
module.log.info('resetting MongoDB indexes...');
|
|
|
|
|
|
|
|
await SitePlatform.resetIndexes(module);
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
module.log.error('failed to reset database indexes', { error });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* SERVER INIT
|
|
|
|
* SERVER INIT
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -135,6 +166,18 @@ module.dvrIngest = async (episodeId) => {
|
|
|
|
await module.dvrIngest(target);
|
|
|
|
await module.dvrIngest(target);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'make-bucket':
|
|
|
|
|
|
|
|
await module.makeBucket(target);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'delete-otp':
|
|
|
|
|
|
|
|
await module.deleteOtpAccount(target);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'reset-indexes':
|
|
|
|
|
|
|
|
await module.resetIndexes();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
throw new Error(`invalid action: ${module.app.options.action}`);
|
|
|
|
throw new Error(`invalid action: ${module.app.options.action}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|