forked from swapnil.bendal/TypeScript-Backend-Template
[fixed] - stable
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
.idea/
|
||||
.vscode/
|
||||
node_modules/
|
||||
build/
|
||||
dist/
|
||||
tmp/
|
||||
temp/
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Product } from "../entities/Product";
|
||||
|
||||
export interface IProductInteractor {
|
||||
createProduct(input: never): Promise<Product>;
|
||||
createProduct(input: Partial<Product>): Promise<Product>;
|
||||
updateStock(id: number, stock: number): Promise<Product>;
|
||||
getProducts(limit: number, offset: number): Promise<Product[]>;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ class error {
|
||||
error = new ApiError(
|
||||
400,
|
||||
messages.join(', '),
|
||||
messages,
|
||||
error.errors,
|
||||
true,
|
||||
err.stack
|
||||
);
|
||||
|
||||
@@ -3,14 +3,14 @@ class ApiError<T = unknown> extends Error {
|
||||
data: T | null;
|
||||
message: string;
|
||||
success: boolean;
|
||||
errors: Array<unknown>;
|
||||
errors: Array<Error>;
|
||||
isOperational: boolean;
|
||||
stack?: string;
|
||||
|
||||
constructor(
|
||||
statusCode: number,
|
||||
message: string = 'Something went wrong',
|
||||
errors: Array<unknown> = [],
|
||||
errors: Array<Error> = [],
|
||||
isOperational: boolean = true,
|
||||
stack?: string
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user