1
0
Fork 0
mirror of synced 2024-06-22 04:10:54 +12:00

making HTTP POST and PUT readable, more robust app import to avoid document conflicts

This commit is contained in:
Martin McKeaveney 2021-05-29 13:52:31 +01:00
parent 598f189a65
commit 33304606e1
3 changed files with 22 additions and 1305 deletions

View file

@ -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)

View file

@ -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