Skip to content

Commit 33bd151

Browse files
committed
CCM-7465: remove undefined from API response
1 parent 1e04f87 commit 33bd151

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lambdas/backend-api/src/__tests__/utils/remove-undefined.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable unicorn/no-null */
2-
import { removeUndefinedFromObject } from '@utils/remove-undefined';
2+
import { removeUndefinedFromObject } from '@backend-api/utils/remove-undefined';
33

44
type TestType = {
55
param1: string;

lambdas/backend-api/src/templates/api/responses.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { removeUndefinedFromObject } from '@backend-api/utils/remove-undefined';
12
import {
23
Failure,
34
Success,
@@ -14,7 +15,7 @@ export const apiSuccess = (
1415
statusCode,
1516
body: JSON.stringify({
1617
statusCode,
17-
templates: result,
18+
templates: result.map((item) => removeUndefinedFromObject(item)),
1819
} satisfies SuccessList),
1920
};
2021
}
@@ -23,7 +24,7 @@ export const apiSuccess = (
2324
statusCode,
2425
body: JSON.stringify({
2526
statusCode,
26-
template: result,
27+
template: removeUndefinedFromObject(result),
2728
} satisfies Success),
2829
};
2930
};

0 commit comments

Comments
 (0)