20 lines
		
	
	
		
			480 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			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),
 | 
						|
	}
 | 
						|
}
 |