Skip to content

Commit 003e18d

Browse files
committed
Add initForFingerprint method to inetOrgPersonCreateDto and update previewFingerprint to utilize it
1 parent b82f92e commit 003e18d

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
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';
44

55
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+
631
@IsString()
732
@ApiProperty()
833
@IsOptional()

src/management/identities/abstract-identities.service.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { createHash } from 'node:crypto';
1616
import { PasswdadmService } from "~/settings/passwdadm.service";
1717
import { DataStatusEnum } from "~/management/identities/_enums/data-status";
1818
import { JobState } from "~/core/jobs/_enums/state.enum";
19+
import { inetOrgPersonDto } from './_dto/_parts/inetOrgPerson.dto';
1920

2021
@Injectable()
2122
export abstract class AbstractIdentitiesService extends AbstractServiceSchema {
@@ -136,19 +137,13 @@ export abstract class AbstractIdentitiesService extends AbstractServiceSchema {
136137
}
137138

138139
protected async previewFingerprint(identity: any): Promise<string> {
140+
const inetOrgPerson = inetOrgPersonDto.initForFingerprint(identity.inetOrgPerson);
141+
139142
const additionalFields = omit(identity.additionalFields, ['validations']);
140143
const data = construct(
141144
omit(
142145
toPlainAndCrush({
143-
// dataStatus: identity.dataStatus,
144-
// state: identity.state,
145-
// lifecycle: identity.lifecycle,
146-
// srcFusionId: identity.srcFusionId,
147-
// primaryEmployeeNumber: identity.primaryEmployeeNumber,
148-
// initState: identity.initState,
149-
// deletedFlag: identity.deletedFlag,
150-
151-
inetOrgPerson: identity.inetOrgPerson,
146+
inetOrgPerson,
152147
additionalFields,
153148
}) as any,
154149
[

0 commit comments

Comments
 (0)