From 278e130614313d8ed1b43d051822f000b9f80b4d Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sat, 4 Nov 2017 21:05:41 +0100 Subject: [PATCH] Delete log db data on war delete --- api/routes/wars.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/routes/wars.js b/api/routes/wars.js index 7726b68..3c3fe61 100644 --- a/api/routes/wars.js +++ b/api/routes/wars.js @@ -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; -- 2.25.1