mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
21 lines
565 B
TypeScript
21 lines
565 B
TypeScript
import ProjectType from '@/types/project'
|
|
import { getProjectImages } from './images'
|
|
import { markdownToHtml } from './markdown'
|
|
|
|
export async function transformProject(
|
|
projectsOriginal: ProjectType[],
|
|
slug: string
|
|
) {
|
|
const project = projectsOriginal.find((item) => item.slug === slug)
|
|
if (!project) return
|
|
|
|
// enhance data with additional fields
|
|
const descriptionHtml = await markdownToHtml(project.description)
|
|
project.descriptionHtml = descriptionHtml
|
|
|
|
const images = await getProjectImages(slug)
|
|
project.images = images
|
|
|
|
return project
|
|
}
|