-
-
Notifications
You must be signed in to change notification settings - Fork 546
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
ParsedRequest is broken with newest changes in NestJS #443
Comments
hello, because of nestjs/core modified, we need change these files:
changed like this: factory: (_, req) => req.switchToHttp().getRequest()[paramtype],
changed like this: req.switchToHttp().getRequest()[PARSED_CRUD_REQUEST_KEY] So I wrote the following code to temporarily fix the problem create file: crud-fix.js const fs = require('fs');
const files = ['node_modules/@nestjsx/crud/lib/decorators/parsed-request.decorator.js', 'node_modules/@nestjsx/crud/lib/crud/reflection.helper.js'];
fs.writeFileSync(files[0], fs.readFileSync(files[0]).toString().replace(/return req\[([^\]]*)]/, 'return req.switchToHttp().getRequest()[$1]'));
fs.writeFileSync(files[1], fs.readFileSync(files[1]).toString().replace('req[paramtype]', 'req.switchToHttp().getRequest()[paramtype]')); then run: node crud-fix.js |
michaelyali
added a commit
that referenced
this issue
Mar 17, 2020
…anges fixed custom routes params caused by NestJs v7 breaking changes fix #443
Fixed in v4.4.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NestJs version: 7.0.1
Package version: 4.4.1
There is a breaking change in the way how we create custom decorators in NestJS v7:
https://docs.nestjs.com/migration-guide#custom-route-decorators
And that will break this decorator: https://github.com/nestjsx/crud/blob/master/packages/crud/src/decorators/parsed-request.decorator.ts
Fix should be easy but it is breaking change like in nestjs migration above. :)
Also there is a problem with
getManyBase
andgetOneBase
. Request here:https://github.com/nestjsx/crud/blob/master/packages/crud/src/crud/crud-routes.factory.ts#L208 is
undefined
, so i get this message fromtypeorm-crud.service.js
:Cannot destructure property
parsedof 'undefined' or 'null'.
The text was updated successfully, but these errors were encountered: