Browse Source

add tx note as model

activeAddress
Ivan Socolsky 9 years ago
parent
commit
67bea09fe8
No known key found for this signature in database GPG Key ID: FAECE6A05FAA4F56
  1. 1
      lib/model/index.js
  2. 34
      lib/model/txnote.js

1
lib/model/index.js

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

34
lib/model/txnote.js

@ -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…
Cancel
Save