clean: first clean archi sandbox implementation

This commit is contained in:
Florian Sylvain
2023-08-05 14:37:53 +02:00
parent 4187f0b2e2
commit 5b4b5a8622
13 changed files with 302 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
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))
}