Skip to content

Commit

Permalink
Test (#393)
Browse files Browse the repository at this point in the history
* checkout and fix

* fix errors and remove env from application (#392)

Co-authored-by: Olasunkanmi Oyinlola

* Offshore dev (#394)

* fix errors and remove env from application

* fix build errors

Co-authored-by: Olasunkanmi Oyinlola <[email protected]>
Co-authored-by: Olasunkanmi Oyinlola <[email protected]>
  • Loading branch information
3 people authored Oct 24, 2023
1 parent d90a534 commit a998d1e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
4 changes: 3 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ lerna-debug.log*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.vscode/launch.json
.vscode/launch.json

.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ContextMiddleWare implements NestMiddleware {
// if (!Object.hasOwn(headers, APIResponseMessage.emailHeader)) {
// errors.email = APIResponseMessage.emailHeaderError;
// }
if (!Object.hasOwn(headers, APIResponseMessage.correlationIdHeader)) {
if (!Object.hasOwnProperty.call(headers, APIResponseMessage.correlationIdHeader)) {
errors.correlationId = APIResponseMessage.correlationIdHeaderError;
}
for (const [key, value] of Object.entries(headers)) {
Expand Down
24 changes: 13 additions & 11 deletions frontend/src/apis/orderApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const reduceSelectedItems = () => {
if (menu.selectedItems) {
menu.selectedItems.forEach((selectedItem) => {
const itemId = selectedItem.id;
const existingItem = result.find((item: any) => item.id === itemId);
const existingItem = result.find(
(item: any) => item.id === itemId
);
if (existingItem) {
existingItem.price += selectedItem.price;
existingItem.quantity! += selectedItem.quantity!;
Expand All @@ -35,13 +37,13 @@ const reduceSelectedItems = () => {
return selectedItems;
};

const getCartItems = () => {
const orderSummary = getOrderSummary();
if (orderSummary?.length) {
const selectedItemsMap = new Map<string, SelectedItem>();
reduceSelectedItems.forEach((item) => {});
orderSummary.map((summary) => {
const cartItem = summary.menus;
});
}
};
// const getCartItems = () => {
// const orderSummary = getOrderSummary();
// if (orderSummary?.length) {
// const selectedItemsMap = new Map<string, SelectedItem>();
// reduceSelectedItems.forEach((item) => {});
// orderSummary.map((summary) => {
// const cartItem = summary.menus;
// });
// }
// };
6 changes: 3 additions & 3 deletions frontend/src/models/order.model.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
interface IOrder {
export interface IOrder {
state: string;
type: string;
merchantId: string;
total: number;
cartItems: IcartItems[];
}

interface IcartItems {
export interface IcartItems {
menuId: string;
total: number;
quantity: number;
selectedItems: IselectedItems[];
}

interface IselectedItems {
export interface IselectedItems {
itemId: string;
menuId: string;
price: number;
Expand Down

0 comments on commit a998d1e

Please sign in to comment.