Commit 6e1e399f authored by Vincent Bechu's avatar Vincent Bechu

mappingstorage: WIP fix post issue with id mapped

parent ed4f6d82
...@@ -334,12 +334,22 @@ ...@@ -334,12 +334,22 @@
this, this,
doc doc
), ),
id = doc[this._property_for_sub_id]; id = doc[this._property_for_sub_id],
storage = this;
if (this._property_for_sub_id && id !== undefined) { if (this._property_for_sub_id && id !== undefined) {
return this._sub_storage.put(id, sub_doc); return this._sub_storage.put(id, sub_doc);
} }
if (!this._id_mapped || doc[this._id_mapped] !== undefined) { if (!this._id_mapped || doc[this._id_mapped] !== undefined) {
return this._sub_storage.post(sub_doc); return getSubStorageId(storage, id, doc)
.push(function (sub_id) {
return storage._sub_storage.put(sub_id, sub_doc);
})
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError) {
return storage._sub_storage.post(sub_doc);
}
throw error;
});
} }
throw new jIO.util.jIOError( throw new jIO.util.jIOError(
"post is not supported with id mapped", "post is not supported with id mapped",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment