Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

WIP: Mongo store.ts schema #19

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WIP: mongo schema
pmespresso committed Jul 2, 2018
commit 3fbf83f6d2f7f99d61b9741001fe3f57952b0755
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -20,5 +20,10 @@
"ts-node": "^5.0.1",
"tslint": "^5.9.1"
},
"workspaces": ["packages/*"]
"workspaces": [
"packages/*"
],
"dependencies": {
"mongoose": "^5.1.7"
}
}
20 changes: 20 additions & 0 deletions packages/gnarly-core/src/stores/mongo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

import mongoose from 'mongoose';

const IPersistTransactionSchema = new mongoose.Schema({
id: { type: String, required: true },
blockHash: { type: String, required: true },
patches: [{
id: { type: String, required: false },
reason: { type: String, requied: false },
operations: [{
op: { type: String, required: false },
path: { type: String, required: false },
value: { type: String, required: false },
volatile: { type: Boolean, required: false },
}];
}];
})

module.exports = IPersistTransactionSchema
3 changes: 1 addition & 2 deletions packages/gnarly-core/test/Ourbit.spec.ts
Original file line number Diff line number Diff line change
@@ -72,9 +72,8 @@ describe('Ourbit', () => {
sandbox.restore()
})

it('should process a transaction', async () => {
it.only('should process a transaction', async () => {
await produceFirstPatch()

globalState.store.saveTransaction.should.have.been.called.with(TEST_KEY, tx)
})