-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.schema.ts
More file actions
39 lines (35 loc) · 1.09 KB
/
interface.schema.ts
File metadata and controls
39 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { z, ObjectId, Entity } from '../../schema';
export const Interface = Entity.merge(
z.object({
ratingId: ObjectId.optional(),
groupId: ObjectId.optional(),
submissions: z.array(ObjectId).optional(),
// commentsOnInterfaces: z.array(ObjectId).optional(),
// revisionsOnInterfaces: z.array(ObjectId).optional(),
version: z.number().optional(),
status: z.enum(['Paused', 'Pending', 'Active', 'Archived', 'Published', 'Draft']).default('Active'),
})
);
export const InterfaceGroup = Entity.merge(
z.object({
roles: z.array(ObjectId).optional(),
})
);
export const InterfaceComponent = Entity.merge(
z.object({
value: z.unknown().optional(),
data: z.record(z.unknown()).optional(),
type: z.string().optional(),
hasAttachment: z.boolean().optional(),
hasValidation: z.boolean().optional(),
isDisabled: z.boolean().optional(),
isEditable: z.boolean().optional(),
isRequired: z.boolean().optional(),
})
);
export const InterfaceSubmission = Entity.merge(
z.object({
interfaceId: ObjectId,
interface: ObjectId.optional(),
})
);