Files
digital-psychology/apps/api/internal/service/admin/scheduled_publication.go
T
jackyu66gitandCursor b91806ba80 feat(ECR-026): OpsCMS ScheduledPublication 只读并 Closed
定时发布目录(ops_scheduled_publications),并加固 catalog 生成器。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-08 03:13:36 +08:00

35 lines
919 B
Go

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
}