budibase/packages/server/middleware/controllers/record.js

18 lines
466 B
JavaScript
Raw Normal View History

2020-04-07 16:12:08 +02:00
const couchdb = require("../../db");
const controller = {
save: async ctx => {
},
fetch: async ctx => {
const databaseId = ctx.params.databaseId;
2020-04-07 18:25:09 +02:00
const database = couchdb.db.use(databaseId)
ctx.body = await database.list({});
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;