Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix comment schema
Rūdolfs Ošiņš committed 2 years ago
commit 149a5d6fb547cc344de9c8754d287d78b2e96888
parent 72bcfdee5abc5aaca3c3c7925e6a67b4c707264c
1 file changed +3 -3
modified httpd-client/lib/project/comment.ts
@@ -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>;