refac: mappers, file names

This commit is contained in:
Floriansylvain
2025-12-22 00:06:17 +01:00
parent e0a6706d4e
commit b50efae8a8
24 changed files with 171 additions and 190 deletions
-46
View File
@@ -1,46 +0,0 @@
package article
import (
domain "RenewCMS/internal/domain/image"
"time"
)
type Article struct {
ID uint32 `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
Images []*domain.Image `json:"images"`
IsOnline bool `json:"is_online"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func FromApi(
title string,
body string,
) Article {
return Article{
Title: title,
Body: body,
}
}
func FromDb(
id uint32,
title string,
body string,
images []*domain.Image,
isOnline bool,
createdAt time.Time,
updatedAt time.Time,
) Article {
return Article{
ID: id,
Title: title,
Body: body,
Images: images,
IsOnline: isOnline,
CreatedAt: createdAt,
UpdatedAt: updatedAt,
}
}
+16
View File
@@ -0,0 +1,16 @@
package article
import (
domain "RenewCMS/internal/domain/image"
"time"
)
type Article struct {
ID uint32 `json:"id"`
Title string `json:"title"`
Body string `json:"body"`
Images []*domain.Image `json:"images"`
IsOnline bool `json:"is_online"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}