Delete log db data on war delete

pull/17/head
HardiReady 2017-11-04 21:05:41 +01:00
parent ee6dc8bc5b
commit 278e130614
1 changed files with 8 additions and 1 deletions

View File

@ -176,8 +176,15 @@ wars.route('/:id')
return next(err);
}
// delete players having this war ID as foreign key
// delete linked appearances
PlayerModel.find({warId: item._id}).remove().exec();
LogKillModel.find({war: item._id}).remove().exec();
LogRespawnModel.find({war: item._id}).remove().exec();
LogReviveModel.find({war: item._id}).remove().exec();
LogFlagModel.find({war: item._id}).remove().exec();
LogBudgetModel.find({war: item._id}).remove().exec();
LogTransportModel.find({war: item._id}).remove().exec();
LogPointsModel.find({war: item._id}).remove().exec();
// check if logfiles exist and delete from fs
const warDir = __dirname + '/../resource/logs/' + req.params.id;