@lenne.tech/nest-server 3.1.0 → 3.1.1
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/dist/core/common/helpers/service.helper.d.ts +2 -1
- package/dist/core/common/helpers/service.helper.js +3 -0
- package/dist/core/common/helpers/service.helper.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/common/helpers/service.helper.ts +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -65,11 +65,11 @@ export class ServiceHelper {
|
|
|
65
65
|
/**
|
|
66
66
|
* Prepare output before return
|
|
67
67
|
*/
|
|
68
|
-
static async prepareOutput(
|
|
68
|
+
static async prepareOutput<T = Record<string, any>>(
|
|
69
69
|
output: any,
|
|
70
70
|
userModel: new () => any,
|
|
71
71
|
userService: any,
|
|
72
|
-
options: { [key: string]: any; clone?: boolean } = {},
|
|
72
|
+
options: { [key: string]: any; clone?: boolean; targetModel?: Partial<T> } = {},
|
|
73
73
|
...args: any[]
|
|
74
74
|
) {
|
|
75
75
|
// Configuration
|
|
@@ -83,6 +83,11 @@ export class ServiceHelper {
|
|
|
83
83
|
output = JSON.parse(JSON.stringify(output));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// Map output if target model exist
|
|
87
|
+
if (options.targetModel) {
|
|
88
|
+
(options.targetModel as any).map(output);
|
|
89
|
+
}
|
|
90
|
+
|
|
86
91
|
// Remove password if exists
|
|
87
92
|
delete output.password;
|
|
88
93
|
|