Removing use of db.post as its dangerous to allow the possibility of _id being auto-generated, these docs would be lost as we couldn't query them out by the usual id mechanism.
This commit is contained in:
parent
c8dbf02acf
commit
e8e331e578
|
@ -104,7 +104,7 @@ describe("third party common", () => {
|
||||||
_id: id,
|
_id: id,
|
||||||
email: email,
|
email: email,
|
||||||
}
|
}
|
||||||
const response = await db.post(dbUser)
|
const response = await db.put(dbUser)
|
||||||
dbUser._rev = response.rev
|
dbUser._rev = response.rev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ exports.authenticateThirdParty = async function (
|
||||||
dbUser = await syncUser(dbUser, thirdPartyUser)
|
dbUser = await syncUser(dbUser, thirdPartyUser)
|
||||||
|
|
||||||
// create or sync the user
|
// create or sync the user
|
||||||
const response = await db.post(dbUser)
|
const response = await db.put(dbUser)
|
||||||
dbUser._rev = response.rev
|
dbUser._rev = response.rev
|
||||||
|
|
||||||
// authenticate
|
// authenticate
|
||||||
|
|
|
@ -51,7 +51,7 @@ exports.buildSchemaFromDb = async function (ctx) {
|
||||||
await connector.buildSchema(datasource._id, datasource.entities)
|
await connector.buildSchema(datasource._id, datasource.entities)
|
||||||
datasource.entities = connector.tables
|
datasource.entities = connector.tables
|
||||||
|
|
||||||
const response = await db.post(datasource)
|
const response = await db.put(datasource)
|
||||||
datasource._rev = response.rev
|
datasource._rev = response.rev
|
||||||
|
|
||||||
ctx.body = datasource
|
ctx.body = datasource
|
||||||
|
@ -89,7 +89,7 @@ exports.save = async function (ctx) {
|
||||||
...ctx.request.body,
|
...ctx.request.body,
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await db.post(datasource)
|
const response = await db.put(datasource)
|
||||||
datasource._rev = response.rev
|
datasource._rev = response.rev
|
||||||
|
|
||||||
// Drain connection pools when configuration is changed
|
// Drain connection pools when configuration is changed
|
||||||
|
|
|
@ -197,7 +197,6 @@ exports.fetchView = async ctx => {
|
||||||
throw "View does not exist."
|
throw "View does not exist."
|
||||||
}
|
}
|
||||||
let response
|
let response
|
||||||
// TODO: make sure not self hosted in Cloud
|
|
||||||
if (env.SELF_HOSTED) {
|
if (env.SELF_HOSTED) {
|
||||||
response = await db.query(`database/${viewName}`, {
|
response = await db.query(`database/${viewName}`, {
|
||||||
include_docs: !calculation,
|
include_docs: !calculation,
|
||||||
|
|
|
@ -145,7 +145,7 @@ exports.save = async function (ctx) {
|
||||||
if (updatedRows && updatedRows.length !== 0) {
|
if (updatedRows && updatedRows.length !== 0) {
|
||||||
await db.bulkDocs(updatedRows)
|
await db.bulkDocs(updatedRows)
|
||||||
}
|
}
|
||||||
const result = await db.post(tableToSave)
|
const result = await db.put(tableToSave)
|
||||||
tableToSave._rev = result.rev
|
tableToSave._rev = result.rev
|
||||||
|
|
||||||
tableToSave = await tableSaveFunctions.after(tableToSave)
|
tableToSave = await tableSaveFunctions.after(tableToSave)
|
||||||
|
|
|
@ -11,7 +11,7 @@ exports.save = async function (ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await db.post(workspaceDoc)
|
const response = await db.put(workspaceDoc)
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
_id: response.id,
|
_id: response.id,
|
||||||
_rev: response.rev,
|
_rev: response.rev,
|
||||||
|
|
Loading…
Reference in New Issue