1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

correct resource paths

This commit is contained in:
Martin McKeaveney 2020-04-07 20:34:21 +01:00
parent c78b14a68a
commit 678b48beec
5 changed files with 38 additions and 29 deletions

View file

@ -3,7 +3,7 @@ const couchdb = require("../../db");
const controller = {
create: async ctx => {
const clientDatabase = couchdb.db.use(ctx.params.clientId);
ctx.body = await clientDatabase.create(ctx.request.body.appname);
ctx.body = await clientDatabase.insert(ctx.request.body);
}
}

View file

@ -0,0 +1,18 @@
const couchdb = require("../../db");
const controller = {
forgotPassword: async ctx => {
},
setPassword: async ctx => {
},
changePassword: async ctx => {
},
authenticate: async ctx => {
}
}
module.exports = controller;

View file

@ -0,0 +1,9 @@
const Router = require("@koa/router");
const controller = require("../../controllers/auth");
const router = Router();
router
.post("/api/authenticate", controller.authenticate);
module.exports = router;

View file

@ -4,30 +4,8 @@ const controller = require("../../controllers/record");
const router = Router();
router
.get("/api/records/:databaseId", controller.fetch)
.post("/api/records/:databaseId", controller.save)
.delete("/api/records/:databaseId/:recordId", controller.destroy)
// router.post(
// "/_builder/instance/:appname/:instanceid/api/record/*",
// routeHandlers.saveRecord
// )
// router.get("/:appname/api/listRecords/*", () => {
// ctx.body = await ctx.instance.indexApi.listItems(indexkey)
// ctx.response.status = StatusCodes.OK
// })
// router.get(
// "/_builder/instance/:appname/:instanceid/api/listRecords/*",
// routeHandlers.listRecordsGet
// )
// router.post("/:appname/api/listRecords/*", routeHandlers.listRecordsPost)
// router.post(
// "/_builder/instance/:appname/:instanceid/api/listRecords/*",
// routeHandlers.listRecordsPost
// )
.get("/api/:databaseId/records", controller.fetch)
.post("/api/:databaseId/records", controller.save)
.delete("/api/:databaseId/records/:recordId", controller.destroy)
module.exports = router;

View file

@ -4,6 +4,10 @@ const controller = require("../../controllers/schema");
const router = Router();
router
.get("/api/schemas/:appId", controller.fetch)
.post("/api/schemas/:appId", controller.save)
.delete("/api/schemas/:appId", controller.delete)
.get("/api/:clientId/:appId/schemas", controller.fetch)
.post("/api/:clientId/:appId/schemas", controller.save)
.patch("/api/:clientId/:appId/schemas/apply", controller.apply)
.delete("/api/:clientId/:appId/schemas/:schemaId", controller.delete)
module.exports = router;