From 2077073986bab894df20ca2c02b1238fec485efd Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 8 Apr 2021 11:57:23 +0100 Subject: [PATCH] move auth controller into it's own dir --- packages/worker/src/api/controllers/{admin => }/auth.js | 0 packages/worker/src/api/routes/admin/index.js | 3 --- packages/worker/src/api/routes/auth.js | 8 ++++++++ packages/worker/src/api/routes/index.js | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) rename packages/worker/src/api/controllers/{admin => }/auth.js (100%) create mode 100644 packages/worker/src/api/routes/auth.js diff --git a/packages/worker/src/api/controllers/admin/auth.js b/packages/worker/src/api/controllers/auth.js similarity index 100% rename from packages/worker/src/api/controllers/admin/auth.js rename to packages/worker/src/api/controllers/auth.js diff --git a/packages/worker/src/api/routes/admin/index.js b/packages/worker/src/api/routes/admin/index.js index 1c64110d2a..2c56f67f3f 100644 --- a/packages/worker/src/api/routes/admin/index.js +++ b/packages/worker/src/api/routes/admin/index.js @@ -1,14 +1,11 @@ const Router = require("@koa/router") -const passport = require("@budibase/auth") const controller = require("../../controllers/admin") -const authController = require("../../controllers/admin/auth") const authenticated = require("../../../middleware/authenticated") const router = Router() router .post("/api/admin/users", authenticated, controller.userSave) - .post("/api/admin/authenticate", authController.authenticate) .delete("/api/admin/users/:email", authenticated, controller.userDelete) .get("/api/admin/users", authenticated, controller.userFetch) .get("/api/admin/users/:email", authenticated, controller.userFind) diff --git a/packages/worker/src/api/routes/auth.js b/packages/worker/src/api/routes/auth.js new file mode 100644 index 0000000000..d40071b774 --- /dev/null +++ b/packages/worker/src/api/routes/auth.js @@ -0,0 +1,8 @@ +const Router = require("@koa/router") +const authController = require("../controllers/auth") + +const router = Router() + +router.post("/api/auth/authenticate", authController.authenticate) + +module.exports = router diff --git a/packages/worker/src/api/routes/index.js b/packages/worker/src/api/routes/index.js index 076710b21b..c6bacc81e5 100644 --- a/packages/worker/src/api/routes/index.js +++ b/packages/worker/src/api/routes/index.js @@ -1,4 +1,5 @@ const adminRoutes = require("./admin") +const authRoutes = require("./auth") const appRoutes = require("./app") -exports.routes = [adminRoutes, appRoutes] +exports.routes = [adminRoutes, authRoutes, appRoutes]