feat: parse body when POSTing a new track

This commit is contained in:
Paul Bienkowski 2020-11-21 13:47:56 +01:00
parent 16ca8db8c7
commit 0c3cf9263d

View file

@ -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();