|
|
|
@ -11,19 +11,18 @@ 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"], |
|
|
|
}) |
|
|
|
|
|
|
|
console.log("Apps: ", body) |
|
|
|
|
|
|
|
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) |
|
|
|
@ -38,7 +37,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 |
|
|
|
|
|
|
|
@ -92,7 +91,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) |
|
|
|
|