This commit is contained in:
S-Reinhard 2026-05-06 13:51:20 +02:00 committed by GitHub
commit a1ef96bfe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 5 deletions

View file

@ -1140,8 +1140,14 @@ class LibraryController {
})
}
// sorting
const key = req.query.sortBy === 'numBooks' ? 'numBooks' : 'name';
const order = req.query.sortOrder === 'desc' ? 'desc' : 'asc';
const narratorArr = Object.values(narrators);
const sorted = naturalSort(narratorArr)[order]((n) => n[key])
res.json({
narrators: naturalSort(Object.values(narrators)).asc((n) => n.name)
narrators: sorted
})
}