package admin import ( "context" "errors" "github.com/google/uuid" "github.com/jackc/pgx/v5" "github.com/yuxingu/digital-psychology/apps/api/internal/repository" ) var ErrScheduledPublicationNotFound = errString("scheduled publication not found") // ListScheduledPublications returns catalog. func (s *Service) ListScheduledPublications(ctx context.Context) ([]repository.ScheduledPublicationRow, error) { items, err := s.Repo.ListScheduledPublications(ctx) if err != nil { return nil, err } if items == nil { items = []repository.ScheduledPublicationRow{} } return items, nil } // GetScheduledPublication loads one. func (s *Service) GetScheduledPublication(ctx context.Context, id uuid.UUID) (*repository.ScheduledPublicationRow, error) { row, err := s.Repo.GetScheduledPublication(ctx, id) if errors.Is(err, pgx.ErrNoRows) { return nil, ErrScheduledPublicationNotFound } return row, err }