✨ Notification list
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/database"
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/models"
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/services"
|
||||
"fmt"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/spf13/viper"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func getUserinfo(c *fiber.Ctx) error {
|
||||
@ -20,7 +21,6 @@ func getUserinfo(c *fiber.Ctx) error {
|
||||
Where(&models.Account{BaseModel: models.BaseModel{ID: user.ID}}).
|
||||
Preload("Profile").
|
||||
Preload("Contacts").
|
||||
Preload("Notifications", "read_at IS NULL").
|
||||
First(&data).Error; err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/database"
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/models"
|
||||
"code.smartsheep.studio/hydrogen/identity/pkg/services"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/samber/lo"
|
||||
"time"
|
||||
)
|
||||
|
||||
func getNotifications(c *fiber.Ctx) error {
|
||||
@ -14,7 +15,7 @@ func getNotifications(c *fiber.Ctx) error {
|
||||
take := c.QueryInt("take", 0)
|
||||
offset := c.QueryInt("offset", 0)
|
||||
|
||||
only_unread := c.QueryBool("only_unread", true)
|
||||
only_unread := !c.QueryBool("past", false)
|
||||
|
||||
tx := database.C.Where(&models.Notification{RecipientID: user.ID}).Model(&models.Notification{})
|
||||
if only_unread {
|
||||
|
Reference in New Issue
Block a user