32 lines
774 B
Go
32 lines
774 B
Go
package mapper
|
|
|
|
import (
|
|
"jaecoo-be/app/database/entity"
|
|
res "jaecoo-be/app/module/galleries/response"
|
|
)
|
|
|
|
func GalleriesResponseMapper(gallery *entity.Galleries, host string) *res.GalleriesResponse {
|
|
if gallery == nil {
|
|
return nil
|
|
}
|
|
|
|
response := &res.GalleriesResponse{
|
|
ID: gallery.ID,
|
|
Title: gallery.Title,
|
|
Description: gallery.Description,
|
|
ThumbnailPath: gallery.ThumbnailPath,
|
|
StatusId: gallery.StatusId,
|
|
IsActive: gallery.IsActive,
|
|
CreatedAt: gallery.CreatedAt,
|
|
UpdatedAt: gallery.UpdatedAt,
|
|
}
|
|
|
|
if gallery.ThumbnailPath != nil && *gallery.ThumbnailPath != "" {
|
|
thumbnailUrl := host + "/galleries/thumbnail/viewer/" + *gallery.ThumbnailPath
|
|
response.ThumbnailUrl = &thumbnailUrl
|
|
}
|
|
|
|
return response
|
|
}
|
|
|