add createdAt
This commit is contained in:
parent
c3c4f8893f
commit
e4534d6076
|
@ -364,11 +364,12 @@ Accounts.link = function (req) {
|
||||||
|
|
||||||
Accounts.getOrCreate = function (req) {
|
Accounts.getOrCreate = function (req) {
|
||||||
var id = Accounts._getTokenId(req.auth);
|
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) {
|
return DB.accounts.get(idNode).then(function (acc) {
|
||||||
if (acc) { return 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 () {
|
return DB.accounts.add(acc).then(function () {
|
||||||
// intentionally not returned to the promise chain
|
// intentionally not returned to the promise chain
|
||||||
DB.save().catch(function (err) {
|
DB.save().catch(function (err) {
|
||||||
|
|
Loading…
Reference in New Issue