feat: fix issues in invite user.

feat: fix update last login at after login.
This commit is contained in:
Ahmed Bouhuolia
2020-09-05 22:18:53 +02:00
parent d35b124178
commit 750377ba86
16 changed files with 535 additions and 336 deletions

View File

@@ -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();
}
}