Skip to content

Commit 39c0c94

Browse files
committed
Refactor identity name generation to use array join for improved readability
1 parent 7d41af7 commit 39c0c94

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/management/identities/identities-crud.controller.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ export class IdentitiesCrudController extends AbstractController {
7878
body.inetOrgPerson.employeeType = 'LOCAL';
7979
}
8080
if (!body.inetOrgPerson.cn) {
81-
body.inetOrgPerson.cn = `${(body.inetOrgPerson.sn || '').toUpperCase()} ${body.inetOrgPerson.givenName}`;
81+
body.inetOrgPerson.cn = [
82+
body.inetOrgPerson.sn?.toUpperCase(),
83+
body.inetOrgPerson.givenName,
84+
].join(' ').trim();
8285
}
8386
if (!body.inetOrgPerson.displayName) {
84-
body.inetOrgPerson.displayName = body.inetOrgPerson.givenName + ' ' + (body.inetOrgPerson.sn || '').toUpperCase();
87+
body.inetOrgPerson.displayName = [
88+
body.inetOrgPerson.givenName,
89+
body.inetOrgPerson.sn?.toUpperCase(),
90+
].join(' ').trim();
8591
}
8692
const data = await this._service.create<Identities>(body);
8793
// If the state is TO_COMPLETE, the identity is created but additional fields are missing or invalid

0 commit comments

Comments
 (0)