fix: removed domain article coupling with infra

This commit is contained in:
Floriansylvain
2025-12-21 21:53:29 +01:00
parent 0eba18e367
commit e0a6706d4e
2 changed files with 37 additions and 42 deletions
+2 -14
View File
@@ -2,7 +2,6 @@ package article
import (
domain "RenewCMS/internal/domain/image"
entity "RenewCMS/internal/infrastructure/persistence/models"
"time"
)
@@ -30,27 +29,16 @@ func FromDb(
id uint32,
title string,
body string,
images []*entity.Image,
images []*domain.Image,
isOnline bool,
createdAt time.Time,
updatedAt time.Time,
) Article {
domainImages := make([]*domain.Image, len(images))
for i, img := range images {
domainImage := domain.FromDB(
img.ID,
img.Path,
img.ArticleID,
img.CreatedAt,
img.UpdatedAt,
)
domainImages[i] = &domainImage
}
return Article{
ID: id,
Title: title,
Body: body,
Images: domainImages,
Images: images,
IsOnline: isOnline,
CreatedAt: createdAt,
UpdatedAt: updatedAt,