Files
Tom Moor bd7fc38ddb feat: Generate Pinyin slugs for Chinese document titles (#14375)
Slugs are now generated only on the server, which lazily loads pinyin-pro.
The client reads the path from the API rather than computing it.
2026-10-31 11:12:24 -04:00

27 lines
814 B
TypeScript

import { ProsemirrorDataHelper } from "@shared/utils/ProsemirrorDataHelper";
import type { Template } from "@server/models";
import presentUser from "./user";
function presentTemplate(template: Template) {
return {
id: template.id,
url: template.path,
path: template.path,
urlId: template.urlId,
title: template.title,
data: template.content ?? ProsemirrorDataHelper.getEmpty(),
icon: template.icon,
color: template.color,
createdAt: template.createdAt,
createdBy: presentUser(template.createdBy),
updatedAt: template.updatedAt,
updatedBy: presentUser(template.updatedBy),
deletedAt: template.deletedAt,
publishedAt: template.publishedAt,
fullWidth: template.fullWidth,
collectionId: template.collectionId,
};
}
export default presentTemplate;