making HTTP POST and PUT readable, more robust app import to avoid document conflicts
This commit is contained in:
parent
ad3e7d9b9a
commit
03a9af0369
|
@ -101,6 +101,7 @@ async function createInstance(template) {
|
|||
if (!ok) {
|
||||
throw "Error loading database dump from template."
|
||||
}
|
||||
var { _rev } = await db.get(DocumentTypes.APP_METADATA)
|
||||
} else {
|
||||
// create the users table
|
||||
await db.put(USERS_TABLE_SCHEMA)
|
||||
|
@ -111,7 +112,7 @@ async function createInstance(template) {
|
|||
await createRoutingView(appId)
|
||||
await createAllSearchIndex(appId)
|
||||
|
||||
return { _id: appId }
|
||||
return { _id: appId, _rev }
|
||||
}
|
||||
|
||||
exports.fetch = async function (ctx) {
|
||||
|
@ -197,6 +198,9 @@ exports.create = async function (ctx) {
|
|||
type: "cloud",
|
||||
},
|
||||
}
|
||||
if (instance._rev) {
|
||||
newApplication._rev = instance._rev
|
||||
}
|
||||
const instanceDb = new CouchDB(appId)
|
||||
await instanceDb.put(newApplication)
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ const SCHEMA = {
|
|||
},
|
||||
query: {
|
||||
create: {
|
||||
readable: true,
|
||||
displayName: "POST",
|
||||
type: QUERY_TYPES.FIELDS,
|
||||
urlDisplay: true,
|
||||
|
@ -40,6 +41,7 @@ const SCHEMA = {
|
|||
},
|
||||
read: {
|
||||
displayName: "GET",
|
||||
readable: true,
|
||||
type: QUERY_TYPES.FIELDS,
|
||||
urlDisplay: true,
|
||||
fields: {
|
||||
|
@ -56,6 +58,7 @@ const SCHEMA = {
|
|||
},
|
||||
update: {
|
||||
displayName: "PUT",
|
||||
readable: true,
|
||||
type: QUERY_TYPES.FIELDS,
|
||||
urlDisplay: true,
|
||||
fields: {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue