feat: parse body when POSTing a new track
This commit is contained in:
parent
16ca8db8c7
commit
0c3cf9263d
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue