-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor audit_period validation middlewares and entire code structur…
…e. refactor entire code quality including testcases
- Loading branch information
Showing
19 changed files
with
1,418 additions
and
1,020 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Request, Response, NextFunction } from 'express'; | ||
|
||
export default async function errorHandler( | ||
err: any, | ||
req: Request, | ||
res: Response, | ||
next: NextFunction, | ||
) { | ||
let status = 500; | ||
if ('code' in err) { | ||
status = err.code; | ||
} | ||
res.status(status).send(err.message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './validate'; | ||
export * from './validate_audit_period'; | ||
export { wrapAsync } from './utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Request, Response, NextFunction } from 'express'; | ||
|
||
export function wrapAsync(fn: Function) { | ||
return function (req: Request, res: Response, next: NextFunction) { | ||
fn(req, res, next).catch(next); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.