Skip to content

Commit 9206033

Browse files
committed
chore: Refactor identities controller and service
1 parent 6c0958f commit 9206033

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/management/identities/identities.controller.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,14 @@ export class IdentitiesController extends AbstractController {
204204
@Res() res: Response,
205205
): Promise<Response> {
206206
try {
207-
const data = await this._service.findById(_id);
207+
const identity = await this._service.findById(_id);
208+
const data = this._service.transformNullsToString(JSON.parse(JSON.stringify(identity)));
208209
return res.status(HttpStatus.OK).json({
209210
statusCode: HttpStatus.OK,
210211
data,
211212
});
212213
} catch (error) {
214+
console.log('error', error);
213215
let validations = error.validations;
214216
if (error instanceof BadRequestException) validations = error.getResponse();
215217
return res.status(HttpStatus.BAD_REQUEST).json({

src/management/identities/identities.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class IdentitiesService extends AbstractServiceSchema {
6767
]),
6868
});
6969

70-
console.log('data', data);
70+
// console.log('data', data);
7171

7272
if (!data?.inetOrgPerson?.employeeNumber || !data?.inetOrgPerson?.employeeType) {
7373
throw new BadRequestException(
@@ -318,7 +318,7 @@ export class IdentitiesService extends AbstractServiceSchema {
318318
}
319319
}
320320

321-
private transformNullsToString(obj) {
321+
public transformNullsToString(obj) {
322322
if (obj === null) {
323323
return "";
324324
}
@@ -332,6 +332,7 @@ export class IdentitiesService extends AbstractServiceSchema {
332332
if (obj[key] === null) {
333333
obj[key] = "";
334334
} else if (typeof obj[key] === 'object') {
335+
console.log('key', key);
335336
obj[key] = this.transformNullsToString(obj[key]);
336337
}
337338
}

0 commit comments

Comments
 (0)