mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: fix issues in invite user.
feat: fix update last login at after login.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { matchedData } from "express-validator";
|
||||
import { Response, Request } from 'express';
|
||||
import { matchedData, validationResult } from "express-validator";
|
||||
import { mapKeys, camelCase, omit } from "lodash";
|
||||
|
||||
export default class BaseController {
|
||||
@@ -11,4 +12,16 @@ export default class BaseController {
|
||||
});
|
||||
return mapKeys(data, (v, k) => camelCase(k));
|
||||
}
|
||||
|
||||
validationResult(req: Request, res: Response, next: NextFunction) {
|
||||
const validationErrors = validationResult(req);
|
||||
|
||||
if (!validationErrors.isEmpty()) {
|
||||
return res.boom.badData(null, {
|
||||
code: 'validation_error',
|
||||
...validationErrors,
|
||||
});
|
||||
}
|
||||
next();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user