codeweaver 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -144
- package/package.json +11 -3
- package/src/config.ts +11 -50
- package/src/constants.ts +1 -0
- package/src/db.ts +183 -0
- package/src/entities/order.entity.ts +68 -0
- package/src/entities/product.entity.ts +75 -0
- package/src/entities/user.entity.ts +38 -0
- package/src/main.ts +19 -7
- package/src/routers/orders/dto/order.dto.ts +54 -30
- package/src/routers/orders/index.router.ts +12 -7
- package/src/routers/orders/order.controller.ts +87 -79
- package/src/routers/products/dto/product.dto.ts +86 -31
- package/src/routers/products/index.router.ts +13 -6
- package/src/routers/products/product.controller.ts +109 -120
- package/src/routers/users/dto/user.dto.ts +13 -19
- package/src/routers/users/index.router.ts +7 -4
- package/src/routers/users/user.controller.ts +72 -98
- package/src/swagger-options.ts +7 -22
- package/src/utilities/assign.ts +44 -59
- package/src/utilities/cache/memory-cache.ts +74 -0
- package/src/utilities/cache/redis-cache.ts +111 -0
- package/src/utilities/container.ts +159 -0
- package/src/utilities/conversion.ts +158 -0
- package/src/utilities/error-handling.ts +98 -26
- package/src/utilities/logger/base-logger.interface.ts +11 -0
- package/src/utilities/logger/logger.config.ts +95 -0
- package/src/utilities/logger/logger.service.ts +122 -0
- package/src/utilities/logger/winston-logger.service.ts +16 -0
- package/src/utilities/types.ts +0 -23
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { logger } from "./logger.config";
|
|
2
|
+
import { Injectable } from "../container";
|
|
3
|
+
import { LoggerService } from "./logger.service";
|
|
4
|
+
|
|
5
|
+
@Injectable({ singleton: true })
|
|
6
|
+
/**
|
|
7
|
+
* WinstonLoggerService is a custom logger service that integrates Winston for advanced logging capabilities.
|
|
8
|
+
*/
|
|
9
|
+
export class WinstonLoggerService extends LoggerService {
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a new LoggerService instance.
|
|
12
|
+
*/
|
|
13
|
+
public constructor() {
|
|
14
|
+
super(logger);
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/utilities/types.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a standardized error response structure for API endpoints
|
|
3
|
-
* @class
|
|
4
|
-
* @property {number} [status] - HTTP status code
|
|
5
|
-
* @property {string} [name] - Error name/type
|
|
6
|
-
* @property {string} message - Human-readable error message
|
|
7
|
-
* @property {string} [stack] - Error stack trace (development only)
|
|
8
|
-
* @property {string} [details] - Additional error details
|
|
9
|
-
*/
|
|
10
|
-
export class ResponseError extends Error {
|
|
11
|
-
public constructor(
|
|
12
|
-
public message: string,
|
|
13
|
-
public status?: number,
|
|
14
|
-
public details?: string,
|
|
15
|
-
public code?: string,
|
|
16
|
-
public stack?: string
|
|
17
|
-
) {
|
|
18
|
-
super(message);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ReturnInfo<T> = [T | null, ResponseError | null];
|
|
23
|
-
export type AsyncReturnInfo<T> = Promise<[T | null, ResponseError | null]>;
|