Browse Source

changed "master" databse to "clientAppLookup"

gh-pages
Michael Shanks 6 years ago
parent
commit
6cb7e995a2
  1. 4
      packages/server/src/api/controllers/application.js
  2. 2
      packages/server/src/api/controllers/auth.js
  3. 2
      packages/server/src/api/controllers/component.js
  4. 2
      packages/server/src/api/controllers/instance.js
  5. 2
      packages/server/src/api/controllers/user.js

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

@ -36,7 +36,7 @@ exports.create = async function(ctx) {
} }
const appId = newid() const appId = newid()
// insert an appId -> clientId lookup // insert an appId -> clientId lookup
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
await masterDb.put({ await masterDb.put({
_id: appId, _id: appId,
clientId, clientId,
@ -113,7 +113,7 @@ const createEmptyAppPackage = async (ctx, app) => {
} }
const lookupClientId = async appId => { const lookupClientId = async appId => {
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
const { clientId } = await masterDb.get(appId) const { clientId } = await masterDb.get(appId)
return clientId return clientId
} }

2
packages/server/src/api/controllers/auth.js

@ -9,7 +9,7 @@ exports.authenticate = async ctx => {
if (!username) ctx.throw(400, "Username Required.") if (!username) ctx.throw(400, "Username Required.")
if (!password) ctx.throw(400, "Password Required") if (!password) ctx.throw(400, "Password Required")
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
const { clientId } = await masterDb.get(ctx.params.appId) const { clientId } = await masterDb.get(ctx.params.appId)
if (!clientId) { if (!clientId) {

2
packages/server/src/api/controllers/component.js

@ -7,7 +7,7 @@ const {
} = require("../../utilities/budibaseDir") } = require("../../utilities/budibaseDir")
exports.fetchAppComponentDefinitions = async function(ctx) { exports.fetchAppComponentDefinitions = async function(ctx) {
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
const { clientId } = await masterDb.get(ctx.params.appId) const { clientId } = await masterDb.get(ctx.params.appId)
const db = new CouchDB(ClientDb.name(clientId)) const db = new CouchDB(ClientDb.name(clientId))
const app = await db.get(ctx.params.appId) const app = await db.get(ctx.params.appId)

2
packages/server/src/api/controllers/instance.js

@ -8,7 +8,7 @@ exports.create = async function(ctx) {
const instanceId = `inst_${appShortId}_${newid()}` const instanceId = `inst_${appShortId}_${newid()}`
const { applicationId } = ctx.params const { applicationId } = ctx.params
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
const { clientId } = await masterDb.get(applicationId) const { clientId } = await masterDb.get(applicationId)
const db = new CouchDB(instanceId) const db = new CouchDB(instanceId)

2
packages/server/src/api/controllers/user.js

@ -41,7 +41,7 @@ exports.create = async function(ctx) {
const response = await database.post(user) const response = await database.post(user)
const masterDb = new CouchDB("master") const masterDb = new CouchDB("clientAppLookup")
const { clientId } = await masterDb.get(appId) const { clientId } = await masterDb.get(appId)
// the clientDB needs to store a map of users against the app // the clientDB needs to store a map of users against the app

Loading…
Cancel
Save