Formatting.

This commit is contained in:
mike12345567 2021-05-05 16:00:15 +01:00
parent 4d49fd4da0
commit 1a2556b6fd
2 changed files with 11 additions and 4 deletions

View File

@ -48,9 +48,12 @@ exports.save = async function (ctx) {
exports.fetch = async function (ctx) { exports.fetch = async function (ctx) {
const db = new CouchDB(GLOBAL_DB) const db = new CouchDB(GLOBAL_DB)
const response = await db.allDocs( const response = await db.allDocs(
getConfigParams({ type: ctx.params.type }, { getConfigParams(
include_docs: true, { type: ctx.params.type },
}) {
include_docs: true,
}
)
) )
ctx.body = response.rows.map(row => row.doc) ctx.body = response.rows.map(row => row.doc)
} }

View File

@ -68,7 +68,11 @@ function buildConfigGetValidation() {
router router
.post("/api/admin/configs", buildConfigSaveValidation(), controller.save) .post("/api/admin/configs", buildConfigSaveValidation(), controller.save)
.delete("/api/admin/configs/:id", controller.destroy) .delete("/api/admin/configs/:id", controller.destroy)
.get("/api/admin/configs/all/:type", buildConfigGetValidation(), controller.fetch) .get(
"/api/admin/configs/all/:type",
buildConfigGetValidation(),
controller.fetch
)
.get("/api/admin/configs/:type", buildConfigGetValidation(), controller.find) .get("/api/admin/configs/:type", buildConfigGetValidation(), controller.find)
module.exports = router module.exports = router