JSON to client (#5553)

This commit is contained in:
Tom Moor
2024-05-24 08:29:00 -04:00
committed by GitHub
parent e1e8257df7
commit d51267b8bc
71 changed files with 651 additions and 378 deletions

View File

@@ -13,6 +13,7 @@ import {
NotificationEventType,
UserRole,
} from "@shared/types";
import { parser } from "@server/editor";
import {
Share,
Team,
@@ -371,10 +372,12 @@ export async function buildDocument(
overrides.collectionId = collection.id;
}
const text = overrides.text ?? "This is the text in an example document";
const document = await Document.create(
{
title: faker.lorem.words(4),
text: "This is the text in an example document",
content: overrides.content ?? parser.parse(text)?.toJSON(),
text,
publishedAt: isNull(overrides.collectionId) ? null : new Date(),
lastModifiedById: overrides.userId,
createdById: overrides.userId,
@@ -410,6 +413,7 @@ export async function buildComment(overrides: {
type: "paragraph",
content: [
{
content: [],
type: "text",
text: "test",
},