issue #20 add sort, not yet in view
All checks were successful
Go / build (push) Successful in 12m10s

This commit is contained in:
2025-04-21 12:11:44 +02:00
parent 6f5c0354cc
commit 8f89c14961
3 changed files with 44 additions and 4 deletions

View File

@@ -333,8 +333,20 @@ func (rc *UserController) InviteHandler(c *gin.Context) {
}
func (rc *UserController) MainView(c *gin.Context) {
shopItems, _ := repositories.ShopItems.GetAll()
fmt.Println(len(shopItems))
itemOrder := c.Query("order")
var shopItems []models.ShopItem
if itemOrder == "newestFirst" {
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
} else if itemOrder == "oldestFirst" {
shopItems, _ = repositories.ShopItems.GetAllNewestLast()
} else if itemOrder == "az" {
shopItems, _ = repositories.ShopItems.GetAllLexicalFirst()
} else if itemOrder == "za" {
shopItems, _ = repositories.ShopItems.GetAllLexicalLast()
} else {
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
}
data := CreateSessionData(c, gin.H{
"title": "shopItem Page",