Browse Source

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

pull/1476/head
Martin McKeaveney 5 years ago
parent
commit
33304606e1
  1. 6
      packages/server/src/api/controllers/application.js
  2. 3
      packages/server/src/integrations/rest.js
  3. 1318
      packages/server/yarn.lock

6
packages/server/src/api/controllers/application.js

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

3
packages/server/src/integrations/rest.js

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

1318
packages/server/yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save