增加站内信未读提醒和后台通知中心+txt 校验
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
)
|
||||
|
||||
var ErrDependencyUnavailable = errors.New("dependency unavailable")
|
||||
var ErrNotificationNotFound = errors.New("notification not found")
|
||||
|
||||
type Service struct {
|
||||
repo *Repository
|
||||
@@ -28,3 +29,21 @@ func (s *Service) MarkRead(ctx context.Context, userID uint64, id uint64) error
|
||||
}
|
||||
return s.repo.MarkRead(ctx, userID, id)
|
||||
}
|
||||
|
||||
func (s *Service) UnreadCount(ctx context.Context, userID uint64) (*UnreadCountDTO, error) {
|
||||
if s.repo == nil {
|
||||
return nil, ErrDependencyUnavailable
|
||||
}
|
||||
count, err := s.repo.UnreadCount(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UnreadCountDTO{UnreadCount: count}, nil
|
||||
}
|
||||
|
||||
func (s *Service) MarkAllRead(ctx context.Context, userID uint64) (int64, error) {
|
||||
if s.repo == nil {
|
||||
return 0, ErrDependencyUnavailable
|
||||
}
|
||||
return s.repo.MarkAllRead(ctx, userID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user