flosight-api/app/models/TransactionItem.js
2014-01-13 18:10:50 -03:00

36 lines
591 B
JavaScript

'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var TransactionItemSchema = new Schema({
txid: String,
index: Number,
addr: {
type: String,
index: true,
},
// >0 is Input <0 is Output
value: Number,
});
TransactionItemSchema.statics.load = function(id, cb) {
this.findOne({
_id: id
}).exec(cb);
};
TransactionItemSchema.statics.fromAddr = function(addr, cb) {
this.find({
addr: addr,
}).exec(cb);
};
module.exports = mongoose.model('TransactionItem', TransactionItemSchema);