From 0c3cf9263d484fe48b8b4afa1effed2ce980346b Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Sat, 21 Nov 2020 13:47:56 +0100 Subject: [PATCH] feat: parse body when POSTing a new track --- routes/api/tracks.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routes/api/tracks.js b/routes/api/tracks.js index 12c5a1d..a967158 100644 --- a/routes/api/tracks.js +++ b/routes/api/tracks.js @@ -162,6 +162,11 @@ router.post( const trackData = new TrackData(); track.trackData = trackData._id; + if (req.body.track.body?.trim()) { + trackData.points = []; + addPointsToTrack({ trackData }, track.body); + } + track.author = user; track.visible = track.author.areTracksVisibleForAll; await trackData.save();