@researchdatabox/sails-hook-redbox-storage-mongo 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/api/models/DeletedRecord.js +24 -0
- package/api/models/Record.js +41 -0
- package/api/models/RecordAudit.js +18 -0
- package/api/services/MongoStorageService.js +895 -0
- package/config/record.js +3 -0
- package/config/storage.js +73 -0
- package/index.js +21 -0
- package/package.json +53 -0
- package/test/bootstrap.js +65 -0
- package/transformer/ExportJSONTransformer.js +47 -0
- package/tsconfig.json +39 -0
- package/typescript/api/services/MongoStorageService.ts +958 -0
- package/typescript/transformer/ExportJSONTransformer.ts +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# ReDBox MongoDB Storage Plugin
|
|
2
|
+
|
|
3
|
+
This project enables storage of ReDBox data (DMPs, Data Records, etc.) in MongoDB.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
### MongoDB
|
|
8
|
+
|
|
9
|
+
- The plugin will use the DB specified by the ['datastore'](https://sailsjs.com/documentation/concepts/models-and-orm/model-settings#?datastore) configured within the [API model definition](https://github.com/redbox-mint/sails-hook-redbox-storage-mongo/blob/master/api/models/Record.js). By default, this is ['redboxStorage'](https://github.com/redbox-mint/redbox-portal/blob/backend-refactor/config/datastores.js#L17).
|
|
10
|
+
- Datastores are configured at the SailsJS level, see [Waterline reference](https://sailsjs.com/documentation/reference/waterline-orm/datastores) and [SailsJS datastores configuration](https://sailsjs.com/documentation/reference/configuration/sails-config-datastores). Specifically, the datastore uses the [sails-mongo adapter](https://github.com/balderdashy/sails-mongo#compatibility), which allows for advanced connection options, including [specifying SSL files, etc.](https://mongodb.github.io/node-mongodb-native/3.5/api/MongoClient.html#.connect)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record.js
|
|
3
|
+
*
|
|
4
|
+
* @description :: The Deleted Record Model for ReDBox
|
|
5
|
+
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
attributes: {
|
|
10
|
+
redboxOid: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
unique: true
|
|
13
|
+
},
|
|
14
|
+
deletedRecordMetadata: {
|
|
15
|
+
type: 'json'
|
|
16
|
+
},
|
|
17
|
+
dateDeleted: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
autoCreatedAt: true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
datastore: 'redboxStorage'
|
|
23
|
+
};
|
|
24
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record.js
|
|
3
|
+
*
|
|
4
|
+
* @description :: The Record Model for ReDBox
|
|
5
|
+
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
attributes: {
|
|
10
|
+
redboxOid: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
unique: true
|
|
13
|
+
},
|
|
14
|
+
harvestId: {
|
|
15
|
+
type: 'string'
|
|
16
|
+
},
|
|
17
|
+
metaMetadata: {
|
|
18
|
+
type: 'json'
|
|
19
|
+
},
|
|
20
|
+
metadata: {
|
|
21
|
+
type: 'json'
|
|
22
|
+
},
|
|
23
|
+
workflow: {
|
|
24
|
+
type: 'json'
|
|
25
|
+
},
|
|
26
|
+
authorization: {
|
|
27
|
+
type: 'json'
|
|
28
|
+
},
|
|
29
|
+
createdAt: false,
|
|
30
|
+
updatedAt: false,
|
|
31
|
+
dateCreated: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
autoCreatedAt: true
|
|
34
|
+
},
|
|
35
|
+
lastSaveDate: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
autoUpdatedAt: true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
datastore: 'redboxStorage'
|
|
41
|
+
};
|