25 lines
650 B
Go
25 lines
650 B
Go
|
|
package service
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
|
||
|
|
"github.com/muyuqingfeng/iloom/auth-service/internal/model"
|
||
|
|
"github.com/muyuqingfeng/iloom/auth-service/internal/repository"
|
||
|
|
)
|
||
|
|
|
||
|
|
type NotificationService struct {
|
||
|
|
repo *repository.NotificationRepo
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewNotificationService(repo *repository.NotificationRepo) *NotificationService {
|
||
|
|
return &NotificationService{repo: repo}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *NotificationService) List(ctx context.Context, userID string) ([]model.Notification, error) {
|
||
|
|
return s.repo.ListByRecipient(ctx, userID)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *NotificationService) MarkRead(ctx context.Context, id, userID string) error {
|
||
|
|
return s.repo.MarkRead(ctx, id, userID)
|
||
|
|
}
|