Files
tyapi-server/internal/application/article/article_application_service.go
2025-09-01 18:29:59 +08:00

46 lines
2.2 KiB
Go

package article
import (
"context"
"tyapi-server/internal/application/article/dto/commands"
appQueries "tyapi-server/internal/application/article/dto/queries"
"tyapi-server/internal/application/article/dto/responses"
)
// ArticleApplicationService 文章应用服务接口
type ArticleApplicationService interface {
// 文章管理
CreateArticle(ctx context.Context, cmd *commands.CreateArticleCommand) error
UpdateArticle(ctx context.Context, cmd *commands.UpdateArticleCommand) error
DeleteArticle(ctx context.Context, cmd *commands.DeleteArticleCommand) error
GetArticleByID(ctx context.Context, query *appQueries.GetArticleQuery) (*responses.ArticleInfoResponse, error)
ListArticles(ctx context.Context, query *appQueries.ListArticleQuery) (*responses.ArticleListResponse, error)
// 文章状态管理
PublishArticle(ctx context.Context, cmd *commands.PublishArticleCommand) error
PublishArticleByID(ctx context.Context, articleID string) error
SchedulePublishArticle(ctx context.Context, cmd *commands.SchedulePublishCommand) error
ArchiveArticle(ctx context.Context, cmd *commands.ArchiveArticleCommand) error
SetFeatured(ctx context.Context, cmd *commands.SetFeaturedCommand) error
// 文章交互
RecordView(ctx context.Context, articleID string, userID string, ipAddress string, userAgent string) error
// 统计信息
GetArticleStats(ctx context.Context) (*responses.ArticleStatsResponse, error)
// 分类管理
CreateCategory(ctx context.Context, cmd *commands.CreateCategoryCommand) error
UpdateCategory(ctx context.Context, cmd *commands.UpdateCategoryCommand) error
DeleteCategory(ctx context.Context, cmd *commands.DeleteCategoryCommand) error
GetCategoryByID(ctx context.Context, query *appQueries.GetCategoryQuery) (*responses.CategoryInfoResponse, error)
ListCategories(ctx context.Context) (*responses.CategoryListResponse, error)
// 标签管理
CreateTag(ctx context.Context, cmd *commands.CreateTagCommand) error
UpdateTag(ctx context.Context, cmd *commands.UpdateTagCommand) error
DeleteTag(ctx context.Context, cmd *commands.DeleteTagCommand) error
GetTagByID(ctx context.Context, query *appQueries.GetTagQuery) (*responses.TagInfoResponse, error)
ListTags(ctx context.Context) (*responses.TagListResponse, error)
}