|
1 | 1 | import { ApiProperty, PartialType } from '@nestjs/swagger'; |
2 | | -import { Type } from 'class-transformer'; |
3 | | -import {IsString, IsEmail, IsOptional, IsArray, ValidateIf} from 'class-validator'; |
| 2 | +import { plainToInstance, Type } from 'class-transformer'; |
| 3 | +import { IsString, IsEmail, IsOptional, IsArray, ValidateIf } from 'class-validator'; |
4 | 4 |
|
5 | 5 | export class inetOrgPersonCreateDto { |
| 6 | + public static initForFingerprint(partial: Partial<inetOrgPersonCreateDto>) { |
| 7 | + return plainToInstance(inetOrgPersonCreateDto, { |
| 8 | + cn: partial.cn || null, |
| 9 | + sn: partial.sn || null, |
| 10 | + uid: partial.uid || null, |
| 11 | + employeeNumber: partial.employeeNumber || [], |
| 12 | + employeeType: partial.employeeType || null, |
| 13 | + departmentNumber: partial.departmentNumber || [], |
| 14 | + displayName: partial.displayName || null, |
| 15 | + facsimileTelephoneNumber: partial.facsimileTelephoneNumber || null, |
| 16 | + givenName: partial.givenName || null, |
| 17 | + labeledURI: partial.labeledURI || null, |
| 18 | + mail: partial.mail || null, |
| 19 | + mobile: partial.mobile || null, |
| 20 | + postalAddress: partial.postalAddress || null, |
| 21 | + preferredLanguage: partial.preferredLanguage || null, |
| 22 | + telephoneNumber: partial.telephoneNumber || null, |
| 23 | + title: partial.title || null, |
| 24 | + userCertificate: partial.userCertificate || null, |
| 25 | + jpegPhoto: partial.jpegPhoto || null, |
| 26 | + |
| 27 | + ...partial |
| 28 | + }); |
| 29 | + } |
| 30 | + |
6 | 31 | @IsString() |
7 | 32 | @ApiProperty() |
8 | 33 | @IsOptional() |
|
0 commit comments