Skip to content

Commit

Permalink
refactor: move identity services to module
Browse files Browse the repository at this point in the history
  • Loading branch information
lamkeewei committed Aug 24, 2021
1 parent faba2fb commit 0308661
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SiteService {
constructor(repository, tokenStore) {
constructor({ repository, tokenStore }) {
this.repository = repository
this.tokenStore = tokenStore
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion services/index.js → services/identity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

0 comments on commit 0308661

Please sign in to comment.