refac: mappers, file names
This commit is contained in:
1 parent
e0a6706d4e
commit
b50efae8a8
24 files changed
+171
-190
No files matched your search
@@ -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,
|
||||
}
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user