Skip to content

Commit f98f00f

Browse files
committed
add block model & remove timestamp from db
1 parent d7e92ea commit f98f00f

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

models/mongodb/block.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict'
2+
3+
const mongoose = require('mongoose')
4+
const Schema = mongoose.Schema
5+
6+
const Block = new Schema({
7+
hash: {
8+
type: String,
9+
index: true,
10+
unique: true
11+
},
12+
blockNumber: {
13+
type: Number,
14+
index: true,
15+
unique: true
16+
},
17+
transactionCount: {
18+
type: Number,
19+
index: true
20+
},
21+
parentHash: {
22+
type: String
23+
},
24+
timestamp: {
25+
type: Number
26+
}
27+
}, { timestamps: false })
28+
29+
module.exports = mongoose.model('Block', Block)

models/mongodb/transaction.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const Schema = mongoose.Schema
66
const Transaction = new Schema({
77
hash: {
88
type: String,
9-
index: true,
10-
unique: true
9+
index: true
1110
},
1211
block: {
1312
type: Number,
@@ -23,10 +22,7 @@ const Transaction = new Schema({
2322
},
2423
tokenAmount: {
2524
type: Number
26-
},
27-
isProcess: {
28-
type: Boolean
2925
}
30-
}, { timestamps: true })
26+
}, { timestamps: false })
3127

3228
module.exports = mongoose.model('Transaction', Transaction)

models/mongodb/wallet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ const Wallet = new Schema({
1717
type: Number,
1818
index: true
1919
}
20-
}, { timestamps: true })
20+
}, { timestamps: false })
2121

2222
module.exports = mongoose.model('Wallet', Wallet)

0 commit comments

Comments
 (0)