I have a dto class-validator, example attached below. Can I remove the userId from the validation without changing the code of the dto itself. For example to do this when using dto in controller
export class CreateEmployeeDto {
@ApiProperty({ required: true })
@IsNumber()
@Expose()
@Validate(RecordExistValidator, [{ model: 'Projects', property: 'id' }], {
message: 'Project not found',
})
projectId: number;
@ApiProperty({ required: true })
@IsNumber()
@IsOptional()
@Expose()
roleId?: number;
@ApiProperty({ required: true })
@IsNumber()
@Expose()
@Validate(RecordExistValidator, [{ model: 'Users', property: 'id' }], {
message: 'User not found',
})
userId: number;
}
Unfortunately I didn’t find a suitable solution.