refac: fixed, better, smarter, correct dependency injection

This commit is contained in:
Florian Sylvain
2025-03-29 00:51:01 +01:00
parent d895477b8c
commit a77a5ad314
35 changed files with 169 additions and 144 deletions
+4 -7
View File
@@ -1,19 +1,16 @@
package useCases
import (
"GoCMS/adapters/secondary/gateways"
"GoCMS/domain/gateways"
"GoCMS/domain/post"
"gorm.io/gorm"
)
type UpdatePostUseCase struct {
postRepository gateways.PostRepository
postRepository gateways.IPostRepository
}
func NewUpdatePostUseCase(db *gorm.DB) *UpdatePostUseCase {
return &UpdatePostUseCase{
postRepository: *gateways.NewPostRepository(db),
}
func NewUpdatePostUseCase(postRepository gateways.IPostRepository) *UpdatePostUseCase {
return &UpdatePostUseCase{postRepository}
}
func (g *UpdatePostUseCase) UpdateBody(id uint32, body string) (post.Post, error) {