-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.models.ts
More file actions
31 lines (27 loc) · 1.37 KB
/
interface.models.ts
File metadata and controls
31 lines (27 loc) · 1.37 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
import * as mongo from '../../util/mongo';
import type * as Types from './interface.types';
export const Interface = mongo.createModel<Types.InterfaceDocument>('Interface', {
key: { type: String, required: true },
submissions: [{ type: mongo.Schema.Types.ObjectId, ref: 'InterfaceSubmission' }],
groupId: { type: mongo.Schema.Types.ObjectId, ref: 'InterfaceGroup', required: true },
status: {
type: String,
default: 'Active', // Default value set here
enum: ['Paused', 'Pending', 'Active', 'Archived', 'Published', 'Draft'],
},
// commentsOnInterfaces: [{ type: mongo.Schema.Types.ObjectId, ref: 'CommentsOnInterfaces' }],
// revisionsOnInterfaces: [{ type: mongo.Schema.Types.ObjectId, ref: 'RevisionsOnInterfaces' }],
});
export const InterfaceGroup = mongo.createModel<Types.InterfaceGroupDocument>('InterfaceGroup', {});
export const InterfaceComponent = mongo.createModel<Types.InterfaceComponentDocument>('InterfaceComponent', {
value: { type: Object, default: {} },
type: { type: String },
hasAttachment: { type: Boolean },
hasValidation: { type: Boolean },
isDisabled: { type: Boolean },
isEditable: { type: Boolean },
isRequired: { type: Boolean },
});
export const InterfaceSubmission = mongo.createModel<Types.InterfaceSubmissionDocument>('InterfaceSubmission', {
interfaceId: { type: mongo.Schema.Types.ObjectId, ref: 'Interface' } as any,
});