[Persistence] Retain original id

...after parsing out space and key, to aid in assembling
the result of getModels as an object where IDs are keys.
This commit is contained in:
Victor Woeltjen 2015-11-05 17:21:59 -08:00
parent 944a5a7424
commit fd4c1ea747

View File

@ -84,9 +84,10 @@ define(
}
// Package the result as id->model
function packageResult(ids, models) {
function packageResult(parsedIds, models) {
var result = {};
ids.forEach(function (id, index) {
parsedIds.forEach(function (parsedId, index) {
var id = parsedId.id;
if (models[index]) {
result[id] = models[index];
}
@ -113,8 +114,8 @@ define(
parsedIds = ids.map(function (id) {
var parts = id.split(":");
return (parts.length > 1) ?
{ space: parts[0], key: parts.slice(1).join(":") } :
{ space: defaultSpace, key: id };
{ id: id, space: parts[0], key: parts.slice(1).join(":") } :
{ id: id, space: defaultSpace, key: id };
});
return persistenceService.listSpaces()