Collections: sort by latest collections first

This commit is contained in:
2026-04-03 15:47:54 +02:00
parent a280647575
commit b1bad80426

View File

@@ -199,7 +199,7 @@ type collectionId struct {
func FetchAllCollections(db *gorm.DB, userId uint, limit int, offset int) ([]CollectionsQueryResult, error) { func FetchAllCollections(db *gorm.DB, userId uint, limit int, offset int) ([]CollectionsQueryResult, error) {
var collections []CollectionsQueryResult var collections []CollectionsQueryResult
var collectionIds []collectionId var collectionIds []collectionId
res := fetchCollections(db, userId).Limit(limit).Offset(offset).Find(&collectionIds) res := fetchCollections(db, userId).Limit(limit).Offset(offset).Order("collections.id DESC").Find(&collectionIds)
if res.Error != nil { if res.Error != nil {
return collections, res.Error return collections, res.Error
} }