1
0
Fork 0
mirror of synced 2024-06-20 19:30:28 +12:00
This commit is contained in:
kevmodrome 2020-06-29 17:49:16 +02:00
parent 53d8bc3be7
commit f50cec4a73
No known key found for this signature in database
GPG key ID: E8F9CD141E63BF38

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)