fix: append to track body in /end too, and save new track in /add
This commit is contained in:
parent
33e8cbdb83
commit
7460661607
|
@ -184,6 +184,9 @@ router.post(
|
|||
track.trackData = trackData._id;
|
||||
track.author = user;
|
||||
|
||||
await track.save()
|
||||
await trackData.save();
|
||||
|
||||
// remember which is the actively building track for this user
|
||||
currentTracks.set(user.id, track._id);
|
||||
|
||||
|
@ -240,6 +243,9 @@ router.post(
|
|||
throw new Error('current user active track is gone, retry upload');
|
||||
}
|
||||
|
||||
track.body += req.body.track.body;
|
||||
await track.save();
|
||||
|
||||
const trackData = await TrackData.findById(track.trackData);
|
||||
trackData.points = Array.from(parseTrackPoints(track.body));
|
||||
await trackData.save();
|
||||
|
|
Loading…
Reference in a new issue