2026-02-10 16:24:37 +00:00
|
|
|
package sync
|
|
|
|
|
|
|
|
|
|
import (
|
2026-02-24 15:34:53 +00:00
|
|
|
"context"
|
2026-02-10 16:24:37 +00:00
|
|
|
//"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
//"strings"
|
|
|
|
|
//"time"
|
|
|
|
|
|
2026-03-03 17:08:58 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
|
|
|
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
2026-03-12 23:49:16 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
2026-02-10 16:24:37 +00:00
|
|
|
//"github.com/Gleipnir-Technology/bob"
|
|
|
|
|
//"github.com/Gleipnir-Technology/bob/dialect/psql"
|
|
|
|
|
//"github.com/Gleipnir-Technology/bob/dialect/psql/sm"
|
|
|
|
|
//"github.com/Gleipnir-Technology/nidus-sync/db"
|
|
|
|
|
//"github.com/Gleipnir-Technology/nidus-sync/db/sql"
|
|
|
|
|
//"github.com/google/uuid"
|
|
|
|
|
//"github.com/uber/h3-go/v4"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type contentNotificationList struct {
|
2026-03-12 23:49:16 +00:00
|
|
|
Notifications []platform.Notification
|
2026-02-10 16:24:37 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-12 23:49:16 +00:00
|
|
|
func getNotificationList(ctx context.Context, r *http.Request, u platform.User) (*html.Response[contentNotificationList], *nhttp.ErrorWithStatus) {
|
|
|
|
|
notifications, err := platform.NotificationsForUser(ctx, u)
|
2026-02-10 16:24:37 +00:00
|
|
|
if err != nil {
|
2026-03-03 17:08:58 +00:00
|
|
|
return nil, nhttp.NewError("Failed to get notifications: %w", err)
|
2026-02-10 16:24:37 +00:00
|
|
|
}
|
2026-03-03 17:08:58 +00:00
|
|
|
return html.NewResponse("sync/notification-list.html", contentNotificationList{
|
2026-02-10 16:24:37 +00:00
|
|
|
Notifications: notifications,
|
2026-02-24 15:34:53 +00:00
|
|
|
}), nil
|
2026-02-10 16:24:37 +00:00
|
|
|
}
|