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,
|
||||
email: email,
|
||||
}
|
||||
const response = await db.post(dbUser)
|
||||
const response = await db.put(dbUser)
|
||||
dbUser._rev = response.rev
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ exports.authenticateThirdParty = async function (
|
|||
dbUser = await syncUser(dbUser, thirdPartyUser)
|
||||
|
||||
// create or sync the user
|
||||
const response = await db.post(dbUser)
|
||||
const response = await db.put(dbUser)
|
||||
dbUser._rev = response.rev
|
||||
|
||||
// authenticate
|
||||
|
|
|
@ -51,7 +51,7 @@ exports.buildSchemaFromDb = async function (ctx) {
|
|||
await connector.buildSchema(datasource._id, datasource.entities)
|
||||
datasource.entities = connector.tables
|
||||
|
||||
const response = await db.post(datasource)
|
||||
const response = await db.put(datasource)
|
||||
datasource._rev = response.rev
|
||||
|
||||
ctx.body = datasource
|
||||
|
@ -89,7 +89,7 @@ exports.save = async function (ctx) {
|
|||
...ctx.request.body,
|
||||
}
|
||||
|
||||
const response = await db.post(datasource)
|
||||
const response = await db.put(datasource)
|
||||
datasource._rev = response.rev
|
||||
|
||||
// Drain connection pools when configuration is changed
|
||||
|
|
|
@ -197,7 +197,6 @@ exports.fetchView = async ctx => {
|
|||
throw "View does not exist."
|
||||
}
|
||||
let response
|
||||
// TODO: make sure not self hosted in Cloud
|
||||
if (env.SELF_HOSTED) {
|
||||
response = await db.query(`database/${viewName}`, {
|
||||
include_docs: !calculation,
|
||||
|
|
|
@ -145,7 +145,7 @@ exports.save = async function (ctx) {
|
|||
if (updatedRows && updatedRows.length !== 0) {
|
||||
await db.bulkDocs(updatedRows)
|
||||
}
|
||||
const result = await db.post(tableToSave)
|
||||
const result = await db.put(tableToSave)
|
||||
tableToSave._rev = result.rev
|
||||
|
||||
tableToSave = await tableSaveFunctions.after(tableToSave)
|
||||
|
|
|
@ -11,7 +11,7 @@ exports.save = async function (ctx) {
|
|||
}
|
||||
|
||||
try {
|
||||
const response = await db.post(workspaceDoc)
|
||||
const response = await db.put(workspaceDoc)
|
||||
ctx.body = {
|
||||
_id: response.id,
|
||||
_rev: response.rev,
|
||||
|
|
Loading…
Reference in New Issue