add tx note as model

This commit is contained in:
Ivan Socolsky 2016-05-17 11:23:29 -03:00
parent f536f58958
commit 67bea09fe8
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
2 changed files with 35 additions and 0 deletions

View File

@ -8,5 +8,6 @@ Model.Address = require('./address');
Model.Notification = require('./notification');
Model.Preferences = require('./preferences');
Model.Email = require('./email');
Model.TxNote = require('./txnote');
module.exports = Model;

34
lib/model/txnote.js Normal file
View File

@ -0,0 +1,34 @@
var _ = require('lodash');
var Uuid = require('uuid');
function TxNote() {};
TxNote.create = function(opts) {
opts = opts || {};
var x = new TxNote();
x.version = 1;
x.walletId = opts.walletId;
x.txid = opts.txid;
x.body = opts.body;
x.lastEditedOn = Math.floor(Date.now() / 1000);
x.lastEditedById = opts.lastEditedById;
return x;
};
TxNote.fromObj = function(obj) {
var x = new TxNote();
x.version = obj.version;
x.walletId = obj.walletId;
x.txid = obj.txid;
x.body = obj.body;
x.lastEditedOn = obj.lastEditedOn;
x.lastEditedById = obj.lastEditedById;
return x;
};
module.exports = TxNote;