SquidSpirit d7c6c97051
All checks were successful
Frontend CI / build (push) Successful in 1m29s
BLOG-43 refactor: rename gateway -> repository
2025-03-28 00:15:39 +08:00

35 lines
748 B
Go

package dbdto
import (
"time"
"git.squidspirit.com/squid/blog.git/backend/internal/domain"
"github.com/thoas/go-funk"
)
type Post struct {
ID uint32
Title string
Content string
Description string
PreviewImageURL string
Labels []*Label
PublishedTime *time.Time
CreatedTime time.Time
UpdatedTime time.Time
}
func (p *Post) ToEntity() *domain.Post {
return &domain.Post{
ID: p.ID,
Title: p.Title,
Content: p.Content,
Description: p.Description,
PreviewImageURL: p.PreviewImageURL,
Labels: funk.Map(p.Labels, func(label *Label) *domain.Label {
return label.ToEntity()
}).([]*domain.Label),
PublishedTime: p.PublishedTime,
}
}