mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 19:53:21 +02:00
26 lines
539 B
Go
26 lines
539 B
Go
package useCases
|
|
|
|
import (
|
|
. "GohCMS2/adapters/secondary/gateways"
|
|
. "GohCMS2/domain/article"
|
|
)
|
|
|
|
type CreateArticleUseCase struct {
|
|
articleRepository ArticleRepository
|
|
}
|
|
|
|
type CreateArticleCommand struct {
|
|
Title string
|
|
Body string
|
|
}
|
|
|
|
func NewCreateArticleUseCase() *CreateArticleUseCase {
|
|
return &CreateArticleUseCase{
|
|
articleRepository: *NewArticleRepository(),
|
|
}
|
|
}
|
|
|
|
func (g *CreateArticleUseCase) CreateAarticle(article CreateArticleCommand) Article {
|
|
return g.articleRepository.Create(FromApi(article.Title, article.Body))
|
|
}
|