mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 07:51:14 +00:00
feat: add release date sorting options and internationalization support
This commit is contained in:
@@ -109,7 +109,7 @@ func handleListResources(c fiber.Ctx) error {
|
||||
if err != nil {
|
||||
return model.NewRequestError("Invalid sort parameter")
|
||||
}
|
||||
if sortInt < 0 || sortInt > 5 {
|
||||
if sortInt < 0 || sortInt > 7 {
|
||||
return model.NewRequestError("Sort parameter out of range")
|
||||
}
|
||||
sort := model.RSort(sortInt)
|
||||
|
||||
@@ -99,6 +99,10 @@ func GetResourceList(page, pageSize int, sort model.RSort) ([]model.Resource, in
|
||||
order = "downloads ASC"
|
||||
case model.RSortDownloadsDesc:
|
||||
order = "downloads DESC"
|
||||
case model.RSortReleaseDateAsc:
|
||||
order = "release_date ASC"
|
||||
case model.RSortReleaseDateDesc:
|
||||
order = "release_date DESC"
|
||||
default:
|
||||
order = "modified_time DESC" // Default sort order
|
||||
}
|
||||
|
||||
@@ -9,4 +9,6 @@ const (
|
||||
RSortViewsDesc
|
||||
RSortDownloadsAsc
|
||||
RSortDownloadsDesc
|
||||
RSortReleaseDateAsc
|
||||
RSortReleaseDateDesc
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user