SquidSpirit a4394eea9e
All checks were successful
Frontend CI / build (push) Successful in 1m56s
BLOG-43 feat: get all posts
2025-03-28 00:02:34 +08:00

20 lines
480 B
Go

package graphdto
import (
"git.squidspirit.com/squid/blog.git/backend/internal/domain"
"github.com/thoas/go-funk"
)
func NewPostDTO(entity *domain.Post) *Post {
return &Post{
ID: entity.ID,
Title: entity.Title,
Content: entity.Content,
Description: entity.Description,
PreviewImageURL: entity.PreviewImageURL,
Labels: funk.Map(entity.Labels, func(label *domain.Label) *Label {
return NewLabelDTO(label)
}).([]*Label),
}
}