This commit is contained in:
kevmodrome 2020-06-29 17:49:16 +02:00
parent 94f257e160
commit 4d4a1bc5b3
1 changed files with 4 additions and 5 deletions

View File

@ -11,18 +11,17 @@ const { exec } = require("child_process")
const sqrl = require("squirrelly")
const setBuilderToken = require("../../utilities/builder/setBuilderToken")
exports.fetch = async function (ctx) {
exports.fetch = async function(ctx) {
const db = new CouchDB(ClientDb.name(getClientId(ctx)))
const body = await db.query("client/by_type", {
include_docs: true,
key: ["app"],
})
ctx.body = body.rows.map(row => row.doc)
}
exports.fetchAppPackage = async function (ctx) {
exports.fetchAppPackage = async function(ctx) {
const clientId = await lookupClientId(ctx.params.applicationId)
const db = new CouchDB(ClientDb.name(clientId))
const application = await db.get(ctx.params.applicationId)
@ -37,7 +36,7 @@ exports.fetchAppPackage = async function (ctx) {
setBuilderToken(ctx, ctx.params.applicationId, devInstance._id)
}
exports.create = async function (ctx) {
exports.create = async function(ctx) {
const clientId =
(ctx.request.body && ctx.request.body.clientId) || env.CLIENT_ID
@ -91,7 +90,7 @@ exports.create = async function (ctx) {
ctx.message = `Application ${ctx.request.body.name} created successfully`
}
exports.update = async function (ctx) {
exports.update = async function(ctx) {
const clientId = await lookupClientId(ctx.params.applicationId)
const db = new CouchDB(ClientDb.name(clientId))
const application = await db.get(ctx.params.applicationId)