Files
radicle-explorer/httpd-client/lib/project/comment.ts
T
Sebastian Martinez f0758de9f3 Add reactions to patch revisions
- Also adapts to the new reactions API schema everywhere.
2024-02-02 13:33:07 +01:00

27 lines
897 B
TypeScript

import type { z } from "zod";
import { array, boolean, number, object, string } from "zod";
import { codeLocationSchema } from "../shared";
export type Comment = z.infer<typeof commentSchema>;
export type Embed = z.infer<typeof commentSchema>["embeds"][0];
export const commentSchema = object({
id: string(),
author: object({ id: string(), alias: string().optional() }),
body: string(),
edits: array(
object({
author: object({ id: string(), alias: string().optional() }),
body: string(),
embeds: array(object({ name: string(), content: string() })),
timestamp: number(),
}),
),
embeds: array(object({ name: string(), content: string() })),
reactions: array(object({ emoji: string(), authors: array(string()) })),
timestamp: number(),
location: codeLocationSchema.nullable().optional(),
resolved: boolean(),
replyTo: string().nullable(),
});