insight-ui-zcash/app/models/Transaction.js

42 lines
587 B
JavaScript
Raw Normal View History

2014-01-07 11:49:42 -08:00
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
*/
var TransactionSchema = new Schema({
hash: {
type: String,
index: true,
unique: true,
},
parsed: {
type: Boolean,
default: false,
},
});
/**
* Statics
*/
TransactionSchema.statics.load = function(id, cb) {
this.findOne({
_id: id
}).exec(cb);
};
TransactionSchema.statics.fromHash = function(hash, cb) {
this.findOne({
hash: hash,
}).exec(cb);
};
module.exports = mongoose.model('Transaction', TransactionSchema);