domain model fixes
This commit is contained in:
parent
44f5812a36
commit
294817d17b
|
@ -140,13 +140,13 @@ var Login = function (obj, alreadyEncrypted, localData) {
|
||||||
var Cipher = function (obj, alreadyEncrypted, localData) {
|
var Cipher = function (obj, alreadyEncrypted, localData) {
|
||||||
buildDomainModel(this, obj, {
|
buildDomainModel(this, obj, {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
type: 'type',
|
|
||||||
organizationId: 'organizationId',
|
organizationId: 'organizationId',
|
||||||
folderId: 'folderId',
|
folderId: 'folderId',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
notes: 'notes'
|
notes: 'notes'
|
||||||
}, alreadyEncrypted, ['id', 'type', 'organizationId', 'folderId']);
|
}, alreadyEncrypted, ['id', 'organizationId', 'folderId']);
|
||||||
|
|
||||||
|
this.type = obj.type;
|
||||||
this.favorite = obj.favorite ? true : false;
|
this.favorite = obj.favorite ? true : false;
|
||||||
this.organizationUseTotp = obj.organizationUseTotp ? true : false;
|
this.organizationUseTotp = obj.organizationUseTotp ? true : false;
|
||||||
this.edit = obj.edit ? true : false;
|
this.edit = obj.edit ? true : false;
|
||||||
|
@ -235,27 +235,25 @@ var Card = function (obj, alreadyEncrypted) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var SecureNote = function (obj, alreadyEncrypted) {
|
var SecureNote = function (obj, alreadyEncrypted) {
|
||||||
buildDomainModel(this, obj, {
|
this.type = obj.type;
|
||||||
type: 'type'
|
|
||||||
}, alreadyEncrypted, ['type']);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var Field = function (obj, alreadyEncrypted) {
|
var Field = function (obj, alreadyEncrypted) {
|
||||||
buildModel(this, obj, {
|
this.type = obj.type;
|
||||||
type: 'type',
|
buildDomainModel(this, obj, {
|
||||||
name: 'name',
|
name: 'name',
|
||||||
value: 'value'
|
value: 'value'
|
||||||
}, alreadyEncrypted, ['type']);
|
}, alreadyEncrypted, []);
|
||||||
};
|
};
|
||||||
|
|
||||||
var Attachment = function (obj, alreadyEncrypted) {
|
var Attachment = function (obj, alreadyEncrypted) {
|
||||||
|
this.size = obj.size;
|
||||||
buildDomainModel(this, obj, {
|
buildDomainModel(this, obj, {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
url: 'url',
|
url: 'url',
|
||||||
size: 'size',
|
|
||||||
sizeName: 'sizeName',
|
sizeName: 'sizeName',
|
||||||
fileName: 'fileName'
|
fileName: 'fileName'
|
||||||
}, alreadyEncrypted, ['id', 'url', 'size', 'sizeName']);
|
}, alreadyEncrypted, ['id', 'url', 'sizeName']);
|
||||||
};
|
};
|
||||||
|
|
||||||
var Folder = function (obj, alreadyEncrypted) {
|
var Folder = function (obj, alreadyEncrypted) {
|
||||||
|
@ -550,17 +548,21 @@ function buildDomainModel(model, obj, map, alreadyEncrypted, notEncList) {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
for (var prop in map) {
|
for (var prop in map) {
|
||||||
if (map.hasOwnProperty(prop)) {
|
if (map.hasOwnProperty(prop)) {
|
||||||
var promise = Q().then(function () {
|
/* jshint ignore:start */
|
||||||
if (self[map[prop]]) {
|
(function (theProp) {
|
||||||
return self[map[prop]].decrypt(orgId);
|
var promise = Q().then(function () {
|
||||||
}
|
if (self[map[theProp]]) {
|
||||||
return null;
|
return self[map[theProp]].decrypt(orgId);
|
||||||
}).then(function (val) {
|
}
|
||||||
model[prop] = val;
|
return null;
|
||||||
return;
|
}).then(function (val) {
|
||||||
});
|
model[theProp] = val;
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
promises.push(promise);
|
promises.push(promise);
|
||||||
|
})(prop);
|
||||||
|
/* jshint ignore:end */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue