Fix comment schema

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-06-27 18:21:21 +02:00
parent 72bcfdee5a
commit 149a5d6fb5
+3 -3
View File
@@ -1,5 +1,5 @@
import type { ZodSchema } from "zod";
import { array, number, record, object, string } from "zod";
import { array, number, object, string, tuple } from "zod";
export type ThreadUpdateAction =
| { type: "comment"; body: string; replyTo?: string }
@@ -16,7 +16,7 @@ export interface Comment {
id: string;
author: { id: string; alias?: string };
body: string;
reactions: Record<string, number>[];
reactions: [string, string][];
timestamp: number;
replyTo: string | null;
}
@@ -25,7 +25,7 @@ export const commentSchema = object({
id: string(),
author: object({ id: string(), alias: string().optional() }),
body: string(),
reactions: array(record(string(), number())),
reactions: array(tuple([string(), string()])),
timestamp: number(),
replyTo: string().nullable(),
}) satisfies ZodSchema<Comment>;