Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offshore dev #394

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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