From 7fec4134376bebd00b95e2db0261209d340dc5f0 Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Wed, 20 Jan 2021 18:13:13 +0100 Subject: [PATCH] fix: regenerate public track data when saving a track as visible --- docker-compose.yaml | 2 ++ src/routes/api/tracks.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1df6295..5996af5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,6 +18,8 @@ services: volumes: - ./src:/opt/obsAPI/src - ./local/api-data:/data + - .migrations.js:/opt/obsAPI/.migrations.js + - ./migrations:/opt/obsAPI/migrations/ environment: - PORT=3000 - MONGODB_URL=mongodb://mongo/obsTest diff --git a/src/routes/api/tracks.js b/src/routes/api/tracks.js index ba33f86..8022cf5 100644 --- a/src/routes/api/tracks.js +++ b/src/routes/api/tracks.js @@ -248,6 +248,8 @@ router.put( track.uploadedByUserAgent = normalizeUserAgent(req.headers['user-agent']); await track.writeToOriginalFile(fileBody) + await track.rebuildTrackDataAndSave(); + } else if (track.visible && !track.publicTrackData) { await track.rebuildTrackDataAndSave(); } else { await track.save();