diff --git a/packages/server/middleware/controllers/application.js b/packages/server/middleware/controllers/application.js index f6e3c82df7..213af8768d 100644 --- a/packages/server/middleware/controllers/application.js +++ b/packages/server/middleware/controllers/application.js @@ -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); } } diff --git a/packages/server/middleware/controllers/auth.js b/packages/server/middleware/controllers/auth.js index e69de29bb2..41fa028d71 100644 --- a/packages/server/middleware/controllers/auth.js +++ b/packages/server/middleware/controllers/auth.js @@ -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; \ No newline at end of file diff --git a/packages/server/middleware/routes/neo/auth.js b/packages/server/middleware/routes/neo/auth.js new file mode 100644 index 0000000000..947b1c4092 --- /dev/null +++ b/packages/server/middleware/routes/neo/auth.js @@ -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; \ No newline at end of file diff --git a/packages/server/middleware/routes/neo/record.js b/packages/server/middleware/routes/neo/record.js index 566ad762c0..b626ab6208 100644 --- a/packages/server/middleware/routes/neo/record.js +++ b/packages/server/middleware/routes/neo/record.js @@ -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; \ No newline at end of file diff --git a/packages/server/middleware/routes/neo/schema.js b/packages/server/middleware/routes/neo/schema.js index 50356d72a4..d2582830e5 100644 --- a/packages/server/middleware/routes/neo/schema.js +++ b/packages/server/middleware/routes/neo/schema.js @@ -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) \ No newline at end of file + .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; \ No newline at end of file