File size: 576 Bytes
4782147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { TipTapMentionJsonContent } from "app-types/util";
import { getUserId } from "../actions";
import { ChatExportCommentCreateSchema } from "app-types/chat-export";
import { chatExportRepository } from "lib/db/repository";

export async function addExportChatCommentAction(data: {
  exportId: string;
  content: TipTapMentionJsonContent;
  parentId?: string;
}) {
  const userId = await getUserId();
  const validatedData = ChatExportCommentCreateSchema.parse({
    ...data,
    authorId: userId,
  });
  return await chatExportRepository.insertComment(validatedData);
}