Files
radicle-explorer/httpd-client/lib/project/comment.ts
T
2023-08-08 10:53:49 +02:00

21 lines
554 B
TypeScript

import type { ZodSchema } from "zod";
import { array, number, object, string, tuple } from "zod";
export interface Comment {
id: string;
author: { id: string; alias?: string };
body: string;
reactions: [string, string][];
timestamp: number;
replyTo: string | null;
}
export const commentSchema = object({
id: string(),
author: object({ id: string(), alias: string().optional() }),
body: string(),
reactions: array(tuple([string(), string()])),
timestamp: number(),
replyTo: string().nullable(),
}) satisfies ZodSchema<Comment>;