mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-05 00:01:49 +00:00
33 lines
841 B
Go
33 lines
841 B
Go
package unibox
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/getsentry/sentry-go"
|
|
"github.com/google/uuid"
|
|
"github.com/warmbly/warmbly/internal/errx"
|
|
"github.com/warmbly/warmbly/internal/models"
|
|
)
|
|
|
|
func (s *uniboxService) MarkSeen(ctx context.Context, userID, emailID uuid.UUID, seen bool) *errx.Error {
|
|
if err := s.uniboxRepository.MarkSeen(ctx, userID, emailID, seen); err != nil {
|
|
sentry.CaptureException(err)
|
|
return errx.InternalError()
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *uniboxService) MarkSeenBulk(ctx context.Context, userID uuid.UUID, data *models.MarkSeen) (*models.MarkSeen, *errx.Error) {
|
|
if len(data.EmailIDs) > 500 {
|
|
return nil, errx.ErrSeenMax
|
|
}
|
|
|
|
if err := s.uniboxRepository.MarkSeenBulk(ctx, userID, data.EmailIDs, data.Seen); err != nil {
|
|
sentry.CaptureException(err)
|
|
return nil, errx.InternalError()
|
|
}
|
|
|
|
return data, nil
|
|
}
|