Skip to content

Commit 5bbcbf6

Browse files
authored
Merge pull request #33 from AnselmMarie/fix/amarie/resolving-issues
Fix/amarie/resolving issues
2 parents b634804 + 1ca9543 commit 5bbcbf6

37 files changed

Lines changed: 4191 additions & 3319 deletions

.claude/settings.local.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.gemini/settings.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ npm-debug.log
3333
yarn-error.log
3434
testem.log
3535
/typings
36+
.claude
37+
.gemini
38+
.vscode
3639

3740
# System Files
3841
.DS_Store

.nxignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.claude/worktrees
2+
.gemini
3+
.vscode

.vscode/extensions.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

AGENTS.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

CLAUDE.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

app-hosts/api/src/features/cart/services/delete-cart.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const deleteCartItemService = async (id: string) => {
2525
currentCartData.counter = currentCartData.counter - dataToRemove[0]?.quantity;
2626
currentCartData.total = currentCartData.total - totalPrice;
2727

28-
if (keySplice) {
28+
if (keySplice !== null) {
2929
data.splice(keySplice, 1);
3030
}
3131
currentCartData.data = data;

app-hosts/api/src/features/cart/services/update-cart.service.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ const doesItemExistKeyFn = (
3737
};
3838

3939
const getSpeciesDetail = async (id: string) => {
40-
return Promise.all([
41-
await getPokemonSpeciesService({ id }).catch(() => 'err'),
42-
await getPokemonDetailService({ id }).catch(() => 'err'),
43-
]).then((data) => {
44-
if (data[0] === 'err' || data[1] === 'err') {
45-
return 'err';
46-
}
47-
return { ...data[0], ...data[1] };
48-
});
40+
const [speciesResult, detailResult] = await Promise.all([
41+
getPokemonSpeciesService({ id }).catch(() => 'err' as const),
42+
getPokemonDetailService({ id }).catch(() => 'err' as const),
43+
]);
44+
45+
if (speciesResult === 'err' || detailResult === 'err') {
46+
return 'err' as const;
47+
}
48+
49+
return { ...speciesResult, ...detailResult };
4950
};
5051

5152
export const updateCartItemService = async (payload: CartPayload) => {
@@ -74,6 +75,10 @@ export const updateCartItemService = async (payload: CartPayload) => {
7475
throw errFormat500ResponseUtil();
7576
});
7677

78+
if (speciesData === 'err') {
79+
throw errFormat500ResponseUtil();
80+
}
81+
7782
const evolutionChainSplit = speciesData?.evolution_chain?.url?.split('/');
7883

7984
const evolutionData = await getPokemonEvolutionChainService({
@@ -122,7 +127,7 @@ export const updateCartItemService = async (payload: CartPayload) => {
122127
name: speciesData?.name,
123128
price: pokemonPrice,
124129
quantity: 1,
125-
image: speciesData?.sprites?.other?.['official-artwork']?.front_default,
130+
image: speciesData?.sprites?.other?.['official-artwork']?.front_default ?? '',
126131
isLegendary: speciesData?.is_legendary,
127132
isMythical: speciesData?.is_mythical,
128133
types: speciesData?.types,

0 commit comments

Comments
 (0)