From e4534d6076b6d4e42cdaa9bff2d850d0eb88938c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 5 Aug 2018 05:48:17 +0000 Subject: [PATCH] add createdAt --- lib/extensions/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/extensions/index.js b/lib/extensions/index.js index 86ac086..d07c8fc 100644 --- a/lib/extensions/index.js +++ b/lib/extensions/index.js @@ -364,11 +364,12 @@ Accounts.link = function (req) { Accounts.getOrCreate = function (req) { var id = Accounts._getTokenId(req.auth); - var idNode = { type: 'ppid', name: id }; + var idNode = { createdAt: new Date().toISOString(), type: 'ppid', name: id }; return DB.accounts.get(idNode).then(function (acc) { if (acc) { return acc; } - acc = { id: id, sub: req.auth.sub, iss: req.auth.iss, domains: [], ports: [], nodes: [ idNode ] }; + acc = { createdAt: idNode.createdAt, id: id, sub: req.auth.sub, iss: req.auth.iss, + domains: [], ports: [], nodes: [ idNode ] }; return DB.accounts.add(acc).then(function () { // intentionally not returned to the promise chain DB.save().catch(function (err) {