Refactoring for Gin, NoSurf and SCS continues.
This commit is contained in:
@@ -9,8 +9,7 @@ import (
|
||||
templateHandlers "synlotto-website/internal/handlers/template"
|
||||
httpHelpers "synlotto-website/internal/helpers/http"
|
||||
templateHelpers "synlotto-website/internal/helpers/template"
|
||||
|
||||
"synlotto-website/internal/storage"
|
||||
notificationsStorage "synlotto-website/internal/storage/notifications"
|
||||
)
|
||||
|
||||
func NotificationsHandler(db *sql.DB) http.HandlerFunc {
|
||||
@@ -44,12 +43,12 @@ func MarkNotificationReadHandler(db *sql.DB) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
notification, err := storage.GetNotificationByID(db, userID, notificationID)
|
||||
notification, err := notificationsStorage.GetNotificationByID(db, userID, notificationID)
|
||||
if err != nil {
|
||||
log.Printf("❌ Notification not found or belongs to another user: %v", err)
|
||||
notification = nil
|
||||
} else if !notification.IsRead {
|
||||
err = storage.MarkNotificationAsRead(db, userID, notificationID)
|
||||
err = notificationsStorage.MarkNotificationAsRead(db, userID, notificationID)
|
||||
if err != nil {
|
||||
log.Printf("⚠️ Failed to mark as read: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user