package mapper import ( "go-humas-be/app/database/entity" res "go-humas-be/app/module/articles/response" ) func ArticlesResponseMapper(articlesReq *entity.Articles) (articlesRes *res.ArticlesResponse) { thumbnailUrl := "/articles/thumbnail/viewer/" if articlesReq.ThumbnailName != nil { thumbnailUrl += *articlesReq.ThumbnailName } if articlesReq != nil { articlesRes = &res.ArticlesResponse{ ID: articlesReq.ID, Title: articlesReq.Title, Slug: articlesReq.Slug, Description: articlesReq.Description, HtmlDescription: articlesReq.HtmlDescription, TypeId: articlesReq.TypeId, Tags: articlesReq.Tags, ThumbnailUrl: thumbnailUrl, PageUrl: articlesReq.PageUrl, CreatedById: articlesReq.CreatedById, ShareCount: articlesReq.ShareCount, ViewCount: articlesReq.ViewCount, DownloadCount: articlesReq.DownloadCount, StatusId: articlesReq.StatusId, IsPublish: articlesReq.IsPublish, PublishedAt: articlesReq.PublishedAt, IsActive: articlesReq.IsActive, CreatedAt: articlesReq.CreatedAt, UpdatedAt: articlesReq.UpdatedAt, } } return articlesRes }