Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate /auth endpoint handling to Typescript #215

Merged
merged 62 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1e4997b
refactor: replace authentication routes with nested router in ts
karrui Aug 25, 2020
1b33c2d
feat(AuthService): add validateDomain method
karrui Aug 26, 2020
6228e5c
feat(AuthController): add handleCheckUser function
karrui Aug 26, 2020
286f208
refactor(AuthMiddleware): extract validateDomain from AuthService
karrui Aug 26, 2020
8630ce2
feat(TokenModel): add upsertOtp static method to model
karrui Aug 26, 2020
5ff7333
feat(AuthService): add createLoginOtp function
karrui Aug 26, 2020
bcac535
feat: add UserService to upsert User document on login
karrui Aug 26, 2020
b5c0f80
feat(AuthService): add verifyLoginOtp function
karrui Aug 26, 2020
2b7eccd
refactor: rename validateDomain to getAgencyWithEmail
karrui Aug 26, 2020
40828f6
feat(TokenModel): add incrementAttemptsByEmail function
karrui Aug 26, 2020
e634888
refactor: rename the old AuthController OldAuthController temporarily
karrui Aug 26, 2020
e39a1a4
feat: add validateDomain middleware for entire /auth route
karrui Aug 26, 2020
88d6120
feat(AuthController): add auth controller handler functions
karrui Aug 26, 2020
5dcd1c4
fix: update imports to be relative
karrui Aug 26, 2020
a91ddd9
fix: update middleware to not be router level
karrui Aug 26, 2020
5a1356f
feat: add AuthRules
karrui Aug 26, 2020
50dad9f
feat: add better documentation for functions
karrui Aug 26, 2020
7dcc274
feat: remove unused functions in old auth controller
karrui Aug 26, 2020
d0d238b
feat: add documentation for validateDomain middleware
karrui Aug 26, 2020
1f4ba08
test(AuthController): remove deleted function tests
karrui Aug 26, 2020
7871b74
Merge branch 'develop' into feat/ts-auth-controller
karrui Aug 27, 2020
199ad00
fix: invalid otpGenerator import from merging
karrui Aug 27, 2020
8c853ce
Merge branch 'develop' into feat/ts-auth-controller
karrui Aug 31, 2020
8b70e94
fix(Auth): use new logger instantiation
karrui Aug 31, 2020
07da5ca
Merge branch 'develop' into feat/ts-auth-controller
karrui Sep 1, 2020
153d0b8
chore: add eslint for all "*.spec.ts" files
karrui Sep 1, 2020
3380d20
test(AuthService): add tests for getAgencyWithEmail function
karrui Sep 1, 2020
4cb9f6f
test(AuthService): add tests for createLoginOtp function
karrui Sep 1, 2020
b6a5f9a
test(AuthService): add verifyLoginOtp tests
karrui Sep 1, 2020
eb323e7
test: add mock for get(cf-connecting-ip) in jest-express helper
karrui Sep 1, 2020
8e8989b
test(AuthController): add handleLoginSendOtp tests
karrui Sep 1, 2020
6fc73f7
refactor(AuthController): consolidate logger invocations on error
karrui Sep 1, 2020
1b3e2bd
test(AuthController): add unit tests for handleLoginVerifyOtp
karrui Sep 1, 2020
3e654c0
test(AuthController): add unit tests for handleCheckUser
karrui Sep 1, 2020
1191145
test(jestExpress): enhance mockResponse creation
karrui Sep 1, 2020
cf2c5ed
feat(AuthController): check `req.session` emptiness not truthiness
karrui Sep 1, 2020
4894b2b
test(AuthController): add unit tests for handleSignout function
karrui Sep 1, 2020
e1b23d0
test(AuthMiddleware): add validateDomain unit tests
karrui Sep 1, 2020
94c1dfb
chore: add supertest types
karrui Sep 1, 2020
97b34a6
test: add express-setup integration test helper
karrui Sep 1, 2020
628e86f
test(AuthRoutes): add /checkuser integration tests
karrui Sep 1, 2020
56552b3
fix: update tsconfig.build.json to exclude spec files and public
karrui Sep 1, 2020
a2d0daa
test(AuthRoutes): add integration tests for /auth/sendotp
karrui Sep 1, 2020
d1f8cf6
test(AuthRoutes): restore all mocks after each test
karrui Sep 2, 2020
e7f9b34
test(AuthRoutes): add integration tests for POST /auth/verifyotp
karrui Sep 2, 2020
9819a39
refactor: simplify `request(app)` to just `request`
karrui Sep 2, 2020
4852630
test: add CookieStore helper class to store cookies for auth'd routes
karrui Sep 2, 2020
435b856
refactor: inline methods in auth.rules into auth.routes
karrui Sep 2, 2020
ddf9857
test(AuthRoutes): add GET /auth/signout integration tests
karrui Sep 2, 2020
4264a2a
fix: add guards for undefinedness
karrui Sep 2, 2020
754c7ed
refactor(User): move upsertUser method into user schema
karrui Sep 3, 2020
c8c0217
refactor: convert ApplicationError into abstract class
karrui Sep 3, 2020
9db99b4
refactor(AuthController): update error type check to ApplicationError
karrui Sep 3, 2020
45ef05d
feat: add ResponseWithLocals typing to extend res.locals typing
karrui Sep 3, 2020
b6a48db
feat(AuthController): retrieve agency from res.locals instead
karrui Sep 3, 2020
0f910c0
refactor(UserService): rename upsertAndReturnUser to retrieveUser
karrui Sep 3, 2020
e0befed
test: update tests to use UserService.retrieveUser instead
karrui Sep 3, 2020
f5c9136
Merge branch 'develop' into feat/ts-auth-controller
karrui Sep 3, 2020
ac85062
fix(Auth): import constant.ts instead of now deleted defaults.ts
karrui Sep 3, 2020
f9b30bc
style: fix lint from merging
karrui Sep 3, 2020
a05faaf
Merge branch 'develop' into feat/ts-auth-controller
karrui Sep 3, 2020
04d7209
lint: fix lint issues from stricter lint rules
karrui Sep 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"import/newline-after-import": "error",
"import/no-duplicates": "error"
}
}
},
{ "files": ["*.spec.ts"], "extends": ["plugin:jest/recommended"] }
],
"rules": {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
Expand Down
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
"@types/nodemailer-direct-transport": "^1.0.31",
"@types/promise-retry": "^1.1.3",
"@types/puppeteer-core": "^2.0.0",
"@types/supertest": "^2.0.10",
"@types/triple-beam": "^1.3.2",
"@types/uid-generator": "^2.0.2",
"@types/uuid": "^8.0.0",
Expand Down
Loading