@cendo/database-schemas 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cendo/database-schemas",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "keywords": [],
@@ -0,0 +1,53 @@
1
+ const {Schema} = require('mongoose')
2
+
3
+
4
+ const FileRow = new Schema({
5
+ file: {
6
+ type: Schema.Types.ObjectId,
7
+ index: true,
8
+ required: true
9
+ },
10
+
11
+ line: {
12
+ type: Number,
13
+ required: true
14
+ },
15
+
16
+ unique_id: {
17
+ type: String,
18
+ required: true,
19
+ trim: true,
20
+ },
21
+
22
+ data: {
23
+ type: Schema.Types.Mixed,
24
+ default: {}
25
+ },
26
+
27
+ status: {
28
+ type: String,
29
+ default: 'pending',
30
+ enum: ['pending', 'completed', 'failed', 'cancelled']
31
+ },
32
+
33
+ updated_at: {
34
+ type: Date,
35
+ },
36
+
37
+ created_at: {
38
+ type: Date,
39
+ default: Date.now
40
+ }
41
+ })
42
+
43
+
44
+ FileRow.index({
45
+ file: 1,
46
+ line: 1
47
+ })
48
+
49
+ FileRow.index({
50
+ created_at: 1
51
+ }, {expireAfterSeconds: 12 * 30 * 24 * 3600})//12 months
52
+
53
+ module.exports = FileRow
@@ -0,0 +1,22 @@
1
+ const {Schema} = require('mongoose')
2
+
3
+
4
+ const ImportFile = new Schema({
5
+ name: {
6
+ type: String,
7
+ trim: true,
8
+ },
9
+
10
+ updated_at: {
11
+ type: Date,
12
+ default: Date.now
13
+ },
14
+
15
+ created_at: {
16
+ type: Date,
17
+ default: Date.now
18
+ }
19
+ })
20
+
21
+ module.exports = ImportFile
22
+