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

132
Views
Estoy tratando de validar objetos anidados usando class-validator y NestJS. La identificación del objeto anidado no se puede validar

Probé algunos códigos, pero no puedo validar la identificación de la organización, la identificación del rol. Ambos están anidados como campos. En la solicitud del cartero, ambas identificaciones están dentro del objeto. cómo podemos usar la clase DTO para validar esos campos. A continuación, he adjuntado el cuerpo de mi solicitud de cartero y la clase DTO también.

Esta es mi solicitud de cartero

 { "firstName":"abxc", "lastName": "absh", "login": "user_{{$randomEmail}}", "password":"test123", "organization": { "id":1 }, "role":{ "id":1 } }

Clase CreateUserDTO

 export class CreateOrganizationDTO { @IsNotEmpty() @IsNumber() id: number; } export class CreateUserDto { @IsNotEmpty() @IsString() firstName: string; @IsNotEmpty() @IsString() lastName: string; @IsNotEmpty() @IsEmail() login: string; organization: { id: number; }; role: { id: number; }; }
about 4 years ago · Juan Pablo Isaza
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!