Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
NestJs ParseEnumPipe no se puede resolver

Estoy usando el marco NestJs (me encanta por cierto) y quiero verificar los datos entrantes para que se ajusten a un Enum en Typscript. Así que tengo lo siguiente:

 enum ProductAction { PURCHASE = 'PURCHASE', } @Patch('products/:uuid') async patchProducts( @Param('uuid', ParseUUIDPipe) uuid: string, @Body('action', ParseEnumPipe) action: ProductAction, ) { switch(action) { ... code }

Lo extraño es que cuando ejecuto este código, la primera tubería se compila

 2022-07-21 16:53:51 [error] [ExceptionHandler] Nest can't resolve dependencies of the ParseEnumPipe (?, Object). Please make sure that the argument Object at index [0] is available in the FriendsModule context.

¿Que estoy haciendo mal?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Debe usar @Body('action', new ParseEnumPipe(ProductAction)) action: ProductAction ProductAction porque las enumeraciones no se reflejan directamente para que Nest lea los metadatos, y porque Nest está tratando de descubrir cómo inyectar Object cuando realmente debería estar inyectando la enumeración.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!