-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata-source.model.js
More file actions
42 lines (39 loc) · 944 Bytes
/
data-source.model.js
File metadata and controls
42 lines (39 loc) · 944 Bytes
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
40
41
42
import mongoose, { Schema } from 'mongoose';
import Config from '@Config';
const config = Config.getConfig();
const database = mongoose.connection.useDb(config.mongo.conf_db);
class DataSource extends Schema {
constructor() {
// eslint-disable-next-line no-unused-vars
const dataSource = super(
{
label: {
type: String,
required: true
},
slug: {
type: String,
required: true,
unique: true
},
enabled: {
type: Boolean,
required: true,
default: true
},
default: {
type: Boolean,
required: true,
default: false
},
editableFiles: {
type: Boolean,
required: true,
default: false
}
},
{ versionKey: false }
);
}
}
export default database.model('DataSource', new DataSource(), 'data-sources');