2020-04-07 16:12:08 +02:00
|
|
|
const couchdb = require("../../db");
|
|
|
|
|
|
|
|
const controller = {
|
|
|
|
save: async ctx => {
|
|
|
|
},
|
|
|
|
fetch: async ctx => {
|
2020-04-08 17:57:27 +02:00
|
|
|
const db = couchdb.db.use(ctx.params.databaseId)
|
|
|
|
|
|
|
|
ctx.body = await db.view("database", "all_somemodel", {
|
|
|
|
include_docs: true,
|
|
|
|
key: ["app"]
|
|
|
|
})
|
2020-04-07 16:12:08 +02:00
|
|
|
},
|
|
|
|
destroy: async ctx => {
|
2020-04-07 18:25:09 +02:00
|
|
|
const databaseId = ctx.params.databaseId;
|
|
|
|
const database = couchdb.db.use(databaseId)
|
|
|
|
ctx.body = await database.destroy(ctx.params.recordId);
|
2020-04-07 16:12:08 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = controller;
|