31 lines
768 B
Go
31 lines
768 B
Go
package notification
|
|
|
|
import (
|
|
"hyapp-admin-server/internal/model"
|
|
"hyapp-admin-server/internal/repository"
|
|
)
|
|
|
|
type NotificationService struct {
|
|
store *repository.Store
|
|
}
|
|
|
|
func NewService(store *repository.Store) *NotificationService {
|
|
return &NotificationService{store: store}
|
|
}
|
|
|
|
func (s *NotificationService) ListNotifications() ([]model.Notification, error) {
|
|
return s.store.ListNotifications()
|
|
}
|
|
|
|
func (s *NotificationService) MarkNotificationRead(id uint) (*model.Notification, error) {
|
|
return s.store.MarkNotificationRead(id)
|
|
}
|
|
|
|
func (s *NotificationService) MarkAllNotificationsRead() (int64, error) {
|
|
return s.store.MarkAllNotificationsRead()
|
|
}
|
|
|
|
func (s *NotificationService) DeleteNotification(id uint) error {
|
|
return s.store.DeleteNotification(id)
|
|
}
|