Skip to content

Commit 910c77b

Browse files
committed
Enhance inetOrgPerson DTO with optional fields and validation improvements
1 parent 28f1494 commit 910c77b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/management/identities/_dto/_parts/inetOrgPerson.dto.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApiProperty, PartialType } from '@nestjs/swagger';
2-
import {IsString, IsEmail, IsOptional, IsArray} from 'class-validator';
2+
import { Type } from 'class-transformer';
3+
import { IsString, IsEmail, IsOptional, IsArray } from 'class-validator';
34

45
export class inetOrgPersonCreateDto {
56
@IsString()
@@ -8,9 +9,11 @@ export class inetOrgPersonCreateDto {
89

910
@IsString()
1011
@ApiProperty()
12+
@IsOptional()
1113
public cn: string;
1214

1315
@IsArray()
16+
@Type(() => String)
1417
@IsString({ each: true })
1518
@ApiProperty()
1619
@IsOptional()
@@ -23,6 +26,7 @@ export class inetOrgPersonCreateDto {
2326
@ApiProperty()
2427
@IsArray()
2528
@IsString({ each: true })
29+
@IsOptional()
2630
public departmentNumber: string[];
2731

2832
@IsString()
@@ -52,6 +56,7 @@ export class inetOrgPersonCreateDto {
5256

5357
@IsEmail()
5458
@ApiProperty({ required: false })
59+
@IsOptional()
5560
public mail?: string;
5661

5762
@IsOptional()

src/management/identities/_dto/identities.dto.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger';
2-
import { IsOptional, IsObject, IsEnum, IsNumber } from 'class-validator';
2+
import { IsOptional, IsObject, IsEnum, IsNumber, ValidateNested } from 'class-validator';
33
import { inetOrgPersonDto } from './_parts/inetOrgPerson.dto';
44
import { IdentityState } from '../_enums/states.enum';
55
import { IdentityLifecycle } from '../_enums/lifecycle.enum';
@@ -35,6 +35,7 @@ export class IdentitiesCreateDto extends IntersectionType(CustomFieldsDto, Metad
3535
public lifecycle: number;
3636

3737
@IsObject()
38+
@ValidateNested()
3839
@Type(() => inetOrgPersonDto)
3940
@ApiProperty({ type: inetOrgPersonDto })
4041
public inetOrgPerson: inetOrgPersonDto;

0 commit comments

Comments
 (0)