Compare commits

...

2 Commits

2 changed files with 13 additions and 3 deletions

View File

@ -45,8 +45,7 @@ export default function CouchDocument(id, model, rev, markDeleted) {
"category": "domain object",
"type": model.type,
"owner": "admin",
"name": model.name,
"created": Date.now()
"name": model.name
},
"model": model
};

View File

@ -377,8 +377,18 @@ class CouchObjectProvider {
};
return this.request(ALL_DOCS, 'POST', query, signal).then((response) => {
if (response && response.rows !== undefined) {
if (!response) {
//There was no response - no error code, no rows, nothing - this is bad and should not happen
// Network error, CouchDB unreachable.
if (response === null) {
this.indicator.setIndicatorToState(DISCONNECTED);
}
console.error('Failed to retrieve response: #bulkGet');
} else if (response.rows !== undefined) {
return response.rows.reduce((map, row) => {
//row.doc === null if the document does not exist.
//row.doc === undefined if the document is not found.
if (row.doc !== undefined) {
map[row.key] = this.#getModel(row.doc);
}
@ -647,6 +657,7 @@ class CouchObjectProvider {
this.objectQueue[key].pending = true;
const queued = this.objectQueue[key].dequeue();
let document = new CouchDocument(key, queued.model);
document.metadata.created = Date.now();
this.request(key, "PUT", document).then((response) => {
console.log('create check response', key);
this.#checkResponse(response, queued.intermediateResponse, key);