feat(ECR-026): OpsCMS ScheduledPublication 只读并 Closed

定时发布目录(ops_scheduled_publications),并加固 catalog 生成器。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-08 03:13:36 +08:00
co-authored by Cursor
parent 8c50b3d925
commit b91806ba80
40 changed files with 1909 additions and 2 deletions
@@ -0,0 +1,34 @@
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
}