From a1767c94aab8138561a3e5e01afe773f13421081 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Fri, 24 May 2024 11:34:02 +0200
Subject: [PATCH] comment schema

---
 src/models/commentSchema.ts | 20 ++++++++++++++++++++
 src/types/comment.ts        |  6 ++++++
 src/types/models.ts         |  2 ++
 3 files changed, 28 insertions(+)
 create mode 100644 src/models/commentSchema.ts
 create mode 100644 src/types/comment.ts

diff --git a/src/models/commentSchema.ts b/src/models/commentSchema.ts
new file mode 100644
index 00000000..191a682c
--- /dev/null
+++ b/src/models/commentSchema.ts
@@ -0,0 +1,20 @@
+import { z } from 'zod';
+
+const coordinatesSchema = z.object({
+  x: z.number(),
+  y: z.number(),
+});
+
+export const commentSchema = z.object({
+  title: z.string(),
+  icon: z.string(),
+  type: z.enum(['POINT', 'ALIAS', 'REACTION']),
+  content: z.string(),
+  removed: z.boolean(),
+  coord: coordinatesSchema,
+  modelId: z.number(),
+  elementId: z.string(),
+  id: z.number(),
+  pinned: z.boolean(),
+  owner: z.string().optional(),
+});
diff --git a/src/types/comment.ts b/src/types/comment.ts
new file mode 100644
index 00000000..f42abd2f
--- /dev/null
+++ b/src/types/comment.ts
@@ -0,0 +1,6 @@
+import { Comment } from './models';
+import { PinType } from './pin';
+
+export interface CommentWithPinType extends Comment {
+  pinType: PinType;
+}
diff --git a/src/types/models.ts b/src/types/models.ts
index 3d3ee9e7..0bebd142 100644
--- a/src/types/models.ts
+++ b/src/types/models.ts
@@ -61,6 +61,7 @@ import { targetSchema } from '@/models/targetSchema';
 import { targetSearchNameResult } from '@/models/targetSearchNameResult';
 import { userPrivilegesSchema } from '@/models/userPrivilegesSchema';
 import { z } from 'zod';
+import { commentSchema } from '@/models/commentSchema';
 
 export type Project = z.infer<typeof projectSchema>;
 export type OverviewImageView = z.infer<typeof overviewImageView>;
@@ -118,3 +119,4 @@ export type MarkerSurface = z.infer<typeof markerSurfaceSchema>;
 export type MarkerLine = z.infer<typeof markerLineSchema>;
 export type MarkerWithPosition = z.infer<typeof markerWithPositionSchema>;
 export type Marker = z.infer<typeof markerSchema>;
+export type Comment = z.infer<typeof commentSchema>;
-- 
GitLab