From 7de26a3c1cb0c9eb38198660a544fe1c38732316 Mon Sep 17 00:00:00 2001 From: Swapnil Bendal <84583651+Swapnil155@users.noreply.github.com> Date: Tue, 17 Dec 2024 21:29:26 +0530 Subject: [PATCH] [fixed] - stable --- .gitignore | 2 +- src/interfaces/IProductInteractor.ts | 2 +- src/middleware/error.ts | 2 +- src/utils/helper/ApiError.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0f1db1b..e071dbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .idea/ .vscode/ node_modules/ -build/ +dist/ tmp/ temp/ diff --git a/src/interfaces/IProductInteractor.ts b/src/interfaces/IProductInteractor.ts index d7b2c2b..d373af6 100644 --- a/src/interfaces/IProductInteractor.ts +++ b/src/interfaces/IProductInteractor.ts @@ -1,7 +1,7 @@ import { Product } from "../entities/Product"; export interface IProductInteractor { - createProduct(input: never): Promise; + createProduct(input: Partial): Promise; updateStock(id: number, stock: number): Promise; getProducts(limit: number, offset: number): Promise; } \ No newline at end of file diff --git a/src/middleware/error.ts b/src/middleware/error.ts index b40e14a..5ab4a8d 100644 --- a/src/middleware/error.ts +++ b/src/middleware/error.ts @@ -19,7 +19,7 @@ class error { error = new ApiError( 400, messages.join(', '), - messages, + error.errors, true, err.stack ); diff --git a/src/utils/helper/ApiError.ts b/src/utils/helper/ApiError.ts index 25c1615..9ea3aed 100644 --- a/src/utils/helper/ApiError.ts +++ b/src/utils/helper/ApiError.ts @@ -3,14 +3,14 @@ class ApiError extends Error { data: T | null; message: string; success: boolean; - errors: Array; + errors: Array; isOperational: boolean; stack?: string; constructor( statusCode: number, message: string = 'Something went wrong', - errors: Array = [], + errors: Array = [], isOperational: boolean = true, stack?: string ) {