2020-04-08 04:25:09 +12:00
|
|
|
const couchdb = require("../../db");
|
|
|
|
|
|
|
|
const controller = {
|
2020-04-08 22:18:30 +12:00
|
|
|
fetch: async ctx => {
|
|
|
|
const clientDatabase = couchdb.db.use(ctx.params.clientId);
|
|
|
|
ctx.body = await clientDatabase.list({ type: "app" });
|
|
|
|
},
|
2020-04-08 04:25:09 +12:00
|
|
|
create: async ctx => {
|
2020-04-08 04:41:57 +12:00
|
|
|
const clientDatabase = couchdb.db.use(ctx.params.clientId);
|
2020-04-08 07:34:21 +12:00
|
|
|
ctx.body = await clientDatabase.insert(ctx.request.body);
|
2020-04-08 04:25:09 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = controller;
|