feat: Sort tracks newest first, not oldest
This commit is contained in:
parent
e956f78b2b
commit
e455ff5b68
|
@ -78,7 +78,7 @@ router.get(
|
|||
}
|
||||
|
||||
const [tracks, tracksCount] = await Promise.all([
|
||||
Track.find(query).limit(Number(limit)).skip(Number(offset)).sort({ createdAt: 'desc' }).populate('author').exec(),
|
||||
Track.find(query).sort('-createdAt').limit(Number(limit)).skip(Number(offset)).sort({ createdAt: 'desc' }).populate('author').exec(),
|
||||
Track.countDocuments(query).exec(),
|
||||
]);
|
||||
|
||||
|
@ -106,7 +106,7 @@ router.get(
|
|||
|
||||
const query = { author: req.user.id };
|
||||
const [tracks, tracksCount] = await Promise.all([
|
||||
Track.find(query).limit(Number(limit)).skip(Number(offset)).populate('author').exec(),
|
||||
Track.find(query).sort('-createdAt').limit(Number(limit)).skip(Number(offset)).populate('author').exec(),
|
||||
Track.countDocuments(query),
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue