feat: migrated prisma -> gorm

This commit is contained in:
Florian Sylvain
2023-08-06 19:13:49 +02:00
parent 195c247235
commit e258dccc1c
14 changed files with 149 additions and 166 deletions
+4 -3
View File
@@ -3,18 +3,19 @@ package useCases
import (
. "GohCMS2/adapters/secondary/gateways"
. "GohCMS2/domain/article"
"gorm.io/gorm"
)
type GetArticleUseCase struct {
articleRepository ArticleRepository
}
func NewGetArticleUseCase() *GetArticleUseCase {
func NewGetArticleUseCase(db *gorm.DB) *GetArticleUseCase {
return &GetArticleUseCase{
articleRepository: *NewArticleRepository(),
articleRepository: *NewArticleRepository(db),
}
}
func (g *GetArticleUseCase) GetArticle(id int) Article {
func (g *GetArticleUseCase) GetArticle(id uint32) (Article, error) {
return g.articleRepository.Get(id)
}