add tx note as model
This commit is contained in:
parent
f536f58958
commit
67bea09fe8
|
@ -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;
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue