diff --git a/middleware/auth.js b/middleware/auth.js index e7cf2e83e..cccd98fb3 100644 --- a/middleware/auth.js +++ b/middleware/auth.js @@ -11,7 +11,7 @@ const { NotFoundError } = require("@errors/NotFoundError") const jwtUtils = require("@utils/jwt-utils") // Import services -const { authService, siteService } = require("@services") +const { authService, siteService } = require("@services/identity") // Instantiate router object const auth = express.Router() diff --git a/services/AuthService.js b/services/identity/AuthService.js similarity index 100% rename from services/AuthService.js rename to services/identity/AuthService.js diff --git a/services/SiteService.js b/services/identity/SiteService.js similarity index 91% rename from services/SiteService.js rename to services/identity/SiteService.js index 1b77b5fb8..e6ebeb4e2 100644 --- a/services/SiteService.js +++ b/services/identity/SiteService.js @@ -1,5 +1,5 @@ class SiteService { - constructor(repository, tokenStore) { + constructor({ repository, tokenStore }) { this.repository = repository this.tokenStore = tokenStore } diff --git a/services/TokenStore.js b/services/identity/TokenStore.js similarity index 100% rename from services/TokenStore.js rename to services/identity/TokenStore.js diff --git a/services/index.js b/services/identity/index.js similarity index 85% rename from services/index.js rename to services/identity/index.js index 25b98ec41..5d1da6587 100644 --- a/services/index.js +++ b/services/identity/index.js @@ -9,7 +9,7 @@ const IS_LOCAL_DEV = process.env.NODE_ENV === "LOCAL_DEV" const tokenStore = IS_LOCAL_DEV ? { getToken: (_apiTokenName) => process.env.LOCAL_SITE_ACCESS_TOKEN } : new TokenStore() -const siteService = new SiteService(db.Site, tokenStore) +const siteService = new SiteService({ repository: db.Site, tokenStore }) const authService = new AuthService() module.exports = { authService, siteService }