@rxap/schematic-nestjs 0.1.0-dev.0 → 0.1.0-dev.2
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/CHANGELOG.md +13 -0
- package/README.md +1 -1
- package/package.json +30 -12
- package/src/index.js +1 -2
- package/src/schematics/crud/index.js +14 -18
- package/src/schematics/crud/index.js.map +1 -1
- package/src/schematics/crud/schema.js +1 -2
- package/src/schematics/crud-init/index.js +7 -10
- package/src/schematics/crud-init/index.js.map +1 -1
- package/src/schematics/crud-init/schema.js +1 -2
- package/src/schematics/crud-service/add-module-export.js +8 -13
- package/src/schematics/crud-service/add-module-export.js.map +1 -1
- package/src/schematics/crud-service/add-module-provider.js +8 -13
- package/src/schematics/crud-service/add-module-provider.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-method.js +5 -6
- package/src/schematics/crud-service/coerce-class-method.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-property.js +5 -6
- package/src/schematics/crud-service/coerce-class-property.js.map +1 -1
- package/src/schematics/crud-service/coerce-collection-enum.js +7 -13
- package/src/schematics/crud-service/coerce-collection-enum.js.map +1 -1
- package/src/schematics/crud-service/coerce-module-class.js +5 -9
- package/src/schematics/crud-service/coerce-module-class.js.map +1 -1
- package/src/schematics/crud-service/coerce-source-file-rule.js +3 -7
- package/src/schematics/crud-service/coerce-source-file-rule.js.map +1 -1
- package/src/schematics/crud-service/crud-class/create-method.js +10 -14
- package/src/schematics/crud-service/crud-class/create-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/delete-method.js +9 -13
- package/src/schematics/crud-service/crud-class/delete-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/exists-method.js +9 -13
- package/src/schematics/crud-service/crud-class/exists-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/find-in-group-method.js +5 -9
- package/src/schematics/crud-service/crud-class/find-in-group-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/find-method.js +9 -13
- package/src/schematics/crud-service/crud-class/find-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/get-method.js +9 -13
- package/src/schematics/crud-service/crud-class/get-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-field-method.js +10 -14
- package/src/schematics/crud-service/crud-class/update-field-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-method.js +10 -14
- package/src/schematics/crud-service/crud-class/update-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class.js +22 -26
- package/src/schematics/crud-service/crud-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/create-dto-class.js +5 -9
- package/src/schematics/crud-service/dto-class/create-dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/dto-class.js +21 -25
- package/src/schematics/crud-service/dto-class/dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/update-dto-class.js +5 -9
- package/src/schematics/crud-service/dto-class/update-dto-class.js.map +1 -1
- package/src/schematics/crud-service/index.js +65 -70
- package/src/schematics/crud-service/index.js.map +1 -1
- package/src/schematics/crud-service/options.js +1 -2
- package/src/schematics/crud-service/schema.js +1 -2
- package/src/schematics/feature-microservice/index.js +24 -30
- package/src/schematics/feature-microservice/index.js.map +1 -1
- package/src/schematics/frontend-microservice/index.js +23 -29
- package/src/schematics/frontend-microservice/index.js.map +1 -1
- package/src/schematics/health-indicator/add-health-endpoint.js +8 -12
- package/src/schematics/health-indicator/add-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/add-health-indicator.js +10 -14
- package/src/schematics/health-indicator/add-health-indicator.js.map +1 -1
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js +9 -14
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-controller.js +8 -12
- package/src/schematics/health-indicator/coerce-health-controller.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-module.js +10 -14
- package/src/schematics/health-indicator/coerce-health-module.js.map +1 -1
- package/src/schematics/health-indicator/index.js +18 -21
- package/src/schematics/health-indicator/index.js.map +1 -1
- package/src/schematics/health-indicator-init/index.js +12 -15
- package/src/schematics/health-indicator-init/index.js.map +1 -1
- package/src/schematics/init/index.js +117 -129
- package/src/schematics/init/index.js.map +1 -1
- package/src/schematics/jwt/index.js +14 -17
- package/src/schematics/jwt/index.js.map +1 -1
- package/src/schematics/microservice/index.js +35 -41
- package/src/schematics/microservice/index.js.map +1 -1
- package/src/schematics/open-api/index.js +12 -15
- package/src/schematics/open-api/index.js.map +1 -1
- package/src/schematics/sentry/index.js +25 -30
- package/src/schematics/sentry/index.js.map +1 -1
- package/src/schematics/validator/index.js +7 -10
- package/src/schematics/validator/index.js.map +1 -1
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
function ExistsMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function ExistsMethod(options, className) {
|
|
8
5
|
const { dtoName, documentId, collection, parentCollectionList } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'exists',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(collection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(collection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -26,10 +23,10 @@ function ExistsMethod(options, className) {
|
|
|
26
23
|
writer => {
|
|
27
24
|
writer.write(`const snapshot = await this.firestore`);
|
|
28
25
|
for (const subCollection of parentCollectionList) {
|
|
29
|
-
writer.writeLine(`.collection(Collection.${
|
|
30
|
-
writer.writeLine(`.doc(${
|
|
26
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
27
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
31
28
|
}
|
|
32
|
-
writer.writeLine(`.collection(Collection.${
|
|
29
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
33
30
|
writer.writeLine(`.doc(${documentId})`);
|
|
34
31
|
if (options.privateName) {
|
|
35
32
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -42,5 +39,4 @@ function ExistsMethod(options, className) {
|
|
|
42
39
|
],
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
|
-
exports.ExistsMethod = ExistsMethod;
|
|
46
42
|
//# sourceMappingURL=exists-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exists-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/exists-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exists-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/exists-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,SAAiB;IAC9D,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAC1E,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE;YACV,GAAG,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,GAAI,QA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od(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { Scope, } from 'ts-morph';
|
|
3
|
+
export function FindInGroupMethod(options, className) {
|
|
7
4
|
const { dtoName, camelized, collection, parentCollectionList } = options;
|
|
8
5
|
return {
|
|
9
6
|
name: 'findInGroup',
|
|
10
|
-
scope:
|
|
7
|
+
scope: Scope.Public,
|
|
11
8
|
isAsync: true,
|
|
12
9
|
parameters: [
|
|
13
10
|
{
|
|
@@ -21,7 +18,7 @@ function FindInGroupMethod(options, className) {
|
|
|
21
18
|
`this.logger.verbose('findInGroup', '${className}')`,
|
|
22
19
|
writer => {
|
|
23
20
|
writer.write(`const ref = this.firestore`);
|
|
24
|
-
writer.writeLine(`.collectionGroup(Collection.${
|
|
21
|
+
writer.writeLine(`.collectionGroup(Collection.${underscore(collection).toUpperCase()});`);
|
|
25
22
|
writer.write(`const querySnapshot = await query(ref)`);
|
|
26
23
|
writer.writeLine('.get()');
|
|
27
24
|
writer.writeLine('.catch(FirestoreErrorHandler<QuerySnapshot>(this.logger));');
|
|
@@ -33,5 +30,4 @@ function FindInGroupMethod(options, className) {
|
|
|
33
30
|
],
|
|
34
31
|
};
|
|
35
32
|
}
|
|
36
|
-
exports.FindInGroupMethod = FindInGroupMethod;
|
|
37
33
|
//# sourceMappingURL=find-in-group-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-in-group-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/find-in-group-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-in-group-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/find-in-group-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,iBAAi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
function FindMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function FindMethod(options, className) {
|
|
8
5
|
const { dtoName, camelized, collection, parentCollectionList } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'find',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(collection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(collection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -27,10 +24,10 @@ function FindMethod(options, className) {
|
|
|
27
24
|
writer => {
|
|
28
25
|
writer.write(`const ref = this.firestore`);
|
|
29
26
|
for (const subCollection of parentCollectionList) {
|
|
30
|
-
writer.writeLine(`.collection(Collection.${
|
|
31
|
-
writer.writeLine(`.doc(${
|
|
27
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
28
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
32
29
|
}
|
|
33
|
-
writer.writeLine(`.collection(Collection.${
|
|
30
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()});`);
|
|
34
31
|
writer.write(`const querySnapshot = await query(ref)`);
|
|
35
32
|
writer.writeLine('.get()');
|
|
36
33
|
writer.writeLine('.catch(FirestoreErrorHandler<QuerySnapshot>(this.logger));');
|
|
@@ -42,5 +39,4 @@ function FindMethod(options, className) {
|
|
|
42
39
|
],
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
|
-
exports.FindMethod = FindMethod;
|
|
46
42
|
//# sourceMappingURL=find-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/find-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/find-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,SAAiB;IAC5D,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACzE,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE;YACV,GAAG,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,GAAI,QAAQ,CAAC,UAAU,CAAE,IAAI;gBACnC,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,4BAA4B;gBAClC,WAAW,EAAE,gBAAgB;aAC9B;SACF;QACD,UAAU,EAAE,WAAY,OAAQ,KAAK;QACrC,UAAU,EAAE;YACV,gCAAiC,SAAU,IAAI;YAC/C,MAAM,CAAC,EAAE;gBACP,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBAC3C,KAAK,MAAM,aAAa,IAAI,oBAAoB,EAAE;oBAChD,MAAM,CAAC,SAAS,CAAC,0BAA2B,UAAU,CAAC,aAAa,CAAC,CAAC,WAAW,EAAG,GAAG,CAAC,CAAC;oBACzF,MAAM,CAAC,SAAS,CAAC,QAAS,QAAQ,CAAC,aAAa,CAAE,KAAK,CAAC,CAAC;iBAC1D;gBACD,MAAM,CAAC,SAAS,CAAC,0BAA2B,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,EAAG,IAAI,CAAC,CAAC;gBACvF,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;gBACvD,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC3B,MAAM,CAAC,SAAS,CAAC,4DAA4D,CAAC,CAAC;gBAC/E,MAAM,CAAC,SAAS,CAAC,SAAU,SAAU,uBAAwB,OAAQ,uEAAuE,CAAC,CAAC;gBAC9I,MAAM,CAAC,SAAS,CAAC,kBAAmB,SAAU,YAAa,SAAU,oBAAqB,SAAU,mDAAmD,CAAC,CAAC;gBACzJ,MAAM,CAAC,SAAS,CAAC,sEAAsE,CAAC,CAAC;gBACzF,MAAM,CAAC,KAAK,CAAC,UAAW,SAAU,OAAO,CAAC,CAAC;YAC7C,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
function GetMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function GetMethod(options, className) {
|
|
8
5
|
const { classified, dtoName, documentId, camelized, collection, parentCollectionList } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'get',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(collection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(collection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -26,10 +23,10 @@ function GetMethod(options, className) {
|
|
|
26
23
|
writer => {
|
|
27
24
|
writer.write(`const snapshot = await this.firestore`);
|
|
28
25
|
for (const subCollection of parentCollectionList) {
|
|
29
|
-
writer.writeLine(`.collection(Collection.${
|
|
30
|
-
writer.writeLine(`.doc(${
|
|
26
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
27
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
31
28
|
}
|
|
32
|
-
writer.writeLine(`.collection(Collection.${
|
|
29
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
33
30
|
writer.writeLine(`.doc(${documentId})`);
|
|
34
31
|
if (options.privateName) {
|
|
35
32
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -48,5 +45,4 @@ function GetMethod(options, className) {
|
|
|
48
45
|
],
|
|
49
46
|
};
|
|
50
47
|
}
|
|
51
|
-
exports.GetMethod = GetMethod;
|
|
52
48
|
//# sourceMappingURL=get-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/get-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/get-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,SAAS,CAAC,OAAgB,EAAE,SAAiB;IAC3D,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjG,OAAO;QACL,IAAI,EAAE,KAAK;QACX,K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W,oDAAoD,CAAC,CAAC;gBACrH,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACtB,MAAM,CAAC,SAAS,CAAC,SAAU,SAAU,mBAAoB,OAAQ,4CAA4C,CAAC,CAAC;gBAC/G,MAAM,CAAC,SAAS,CAAC,+BAAgC,SAAU,4BAA4B,CAAC,CAAC;gBACzF,MAAM,CAAC,SAAS,CAAC,+DAA+D,CAAC,CAAC;gBAClF,MAAM,CAAC,KAAK,CAAC,UAAW,SAAU,GAAG,CAAC,CAAC;YACzC,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
function UpdateFieldMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function UpdateFieldMethod(options, className) {
|
|
8
5
|
const { classified, documentId, dtoName, camelized, collection, parentCollectionList, privateName } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'updateField',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(collection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(collection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -44,10 +41,10 @@ function UpdateFieldMethod(options, className) {
|
|
|
44
41
|
writer => {
|
|
45
42
|
writer.write('await this.firestore');
|
|
46
43
|
for (const subCollection of parentCollectionList) {
|
|
47
|
-
writer.writeLine(`.collection(Collection.${
|
|
48
|
-
writer.writeLine(`.doc(${
|
|
44
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
45
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
49
46
|
}
|
|
50
|
-
writer.writeLine(`.collection(Collection.${
|
|
47
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
51
48
|
writer.writeLine(`.doc(${documentId})`);
|
|
52
49
|
if (privateName) {
|
|
53
50
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -58,11 +55,10 @@ function UpdateFieldMethod(options, className) {
|
|
|
58
55
|
},
|
|
59
56
|
`this.logger.debug('updated: ' + ${documentId}, '${className}')`,
|
|
60
57
|
`return this.get(${[
|
|
61
|
-
...parentCollectionList.map(collection => `${
|
|
58
|
+
...parentCollectionList.map(collection => `${camelize(collection)}Id`),
|
|
62
59
|
`${documentId}`,
|
|
63
60
|
].join(', ')})`,
|
|
64
61
|
],
|
|
65
62
|
};
|
|
66
63
|
}
|
|
67
|
-
exports.UpdateFieldMethod = UpdateFieldMethod;
|
|
68
64
|
//# sourceMappingURL=update-field-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-field-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/update-field-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-field-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/update-field-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,SAAiB;IACnE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,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AC,CAAC;oBACpD,MAAM,CAAC,SAAS,CAAC,SAAU,OAAO,CAAC,WAAY,IAAI,CAAC,CAAC;iBACtD;gBACD,MAAM,CAAC,SAAS,CAAC,oDAAoD,CAAC,CAAC;gBACvE,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAC;YAClE,CAAC;YACD,mCAAoC,UAAW,MAAO,SAAU,IAAI;YACpE,mBAAoB;gBAClB,GAAG,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,GAAI,QAAQ,CAAC,UAAU,CAAE,IAAI,CAAC;gBACxE,GAAI,UAAW,EAAE;aAClB,CAAC,IAAI,CAAC,IAAI,CAAE,GAAG;SACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
function UpdateMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function UpdateMethod(options, className) {
|
|
8
5
|
const { classified, documentId, dtoName, camelized, collection, parentCollectionList, privateName } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'update',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(collection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(collection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -35,10 +32,10 @@ function UpdateMethod(options, className) {
|
|
|
35
32
|
writer.writeLine('plain.__updatedAt = new Date()');
|
|
36
33
|
writer.write('await this.firestore');
|
|
37
34
|
for (const subCollection of parentCollectionList) {
|
|
38
|
-
writer.writeLine(`.collection(Collection.${
|
|
39
|
-
writer.writeLine(`.doc(${
|
|
35
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
36
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
40
37
|
}
|
|
41
|
-
writer.writeLine(`.collection(Collection.${
|
|
38
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
42
39
|
writer.writeLine(`.doc(${documentId})`);
|
|
43
40
|
if (privateName) {
|
|
44
41
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -49,11 +46,10 @@ function UpdateMethod(options, className) {
|
|
|
49
46
|
},
|
|
50
47
|
`this.logger.debug('updated: ' + ${documentId}, '${className}')`,
|
|
51
48
|
`return this.get(${[
|
|
52
|
-
...parentCollectionList.map(collection => `${
|
|
49
|
+
...parentCollectionList.map(collection => `${camelize(collection)}Id`),
|
|
53
50
|
`${documentId}`,
|
|
54
51
|
].join(', ')})`,
|
|
55
52
|
],
|
|
56
53
|
};
|
|
57
54
|
}
|
|
58
|
-
exports.UpdateMethod = UpdateMethod;
|
|
59
55
|
//# sourceMappingURL=update-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/update-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/update-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,SAAiB;IAC9D,MAAM,E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,CAAC,WAAW,EAAG,GAAG,CAAC,CAAC;gBACtF,MAAM,CAAC,SAAS,CAAC,QAAS,UAAW,GAAG,CAAC,CAAC;gBAC1C,IAAI,WAAW,EAAE;oBACf,MAAM,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;oBACpD,MAAM,CAAC,SAAS,CAAC,SAAU,OAAO,CAAC,WAAY,IAAI,CAAC,CAAC;iBACtD;gBACD,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;gBACnC,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAC;YAClE,CAAC;YACD,mCAAoC,UAAW,MAAO,SAAU,IAAI;YACpE,mBAAoB;gBAClB,GAAG,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,GAAI,QAAQ,CAAC,UAAU,CAAE,IAAI,CAAC;gBACxE,GAAI,UAAW,EAAE;aAClB,CAAC,IAAI,CAAC,IAAI,CAAE,GAAG;SACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const update_method_1 = require("./crud-class/update-method");
|
|
13
|
-
const update_field_method_1 = require("./crud-class/update-field-method");
|
|
14
|
-
function CrudClass(sourceFile, options) {
|
|
1
|
+
import { CoerceClass } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { Scope, } from 'ts-morph';
|
|
3
|
+
import { CreateMethod } from './crud-class/create-method';
|
|
4
|
+
import { DeleteMethod } from './crud-class/delete-method';
|
|
5
|
+
import { ExistsMethod } from './crud-class/exists-method';
|
|
6
|
+
import { FindInGroupMethod } from './crud-class/find-in-group-method';
|
|
7
|
+
import { FindMethod } from './crud-class/find-method';
|
|
8
|
+
import { GetMethod } from './crud-class/get-method';
|
|
9
|
+
import { UpdateMethod } from './crud-class/update-method';
|
|
10
|
+
import { UpdateFieldMethod } from './crud-class/update-field-method';
|
|
11
|
+
export function CrudClass(sourceFile, options) {
|
|
15
12
|
const { classified, dtoName, dasherized } = options;
|
|
16
13
|
if (options.overwrite) {
|
|
17
14
|
// TODO : replace hack with correct implementation to remove all statements
|
|
@@ -79,18 +76,18 @@ function CrudClass(sourceFile, options) {
|
|
|
79
76
|
]);
|
|
80
77
|
const className = classified + 'CrudService';
|
|
81
78
|
const methods = [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
CreateMethod(options, className),
|
|
80
|
+
DeleteMethod(options, className),
|
|
81
|
+
UpdateMethod(options, className),
|
|
82
|
+
GetMethod(options, className),
|
|
83
|
+
ExistsMethod(options, className),
|
|
84
|
+
UpdateFieldMethod(options, className),
|
|
88
85
|
];
|
|
89
86
|
if (!options.privateName) {
|
|
90
|
-
methods.push(
|
|
91
|
-
methods.push(
|
|
87
|
+
methods.push(FindMethod(options, className));
|
|
88
|
+
methods.push(FindInGroupMethod(options, className));
|
|
92
89
|
}
|
|
93
|
-
|
|
90
|
+
CoerceClass(sourceFile, className, {
|
|
94
91
|
isExported: true,
|
|
95
92
|
decorators: [
|
|
96
93
|
{
|
|
@@ -102,14 +99,14 @@ function CrudClass(sourceFile, options) {
|
|
|
102
99
|
{
|
|
103
100
|
parameters: [
|
|
104
101
|
{
|
|
105
|
-
scope:
|
|
102
|
+
scope: Scope.Private,
|
|
106
103
|
isReadonly: true,
|
|
107
104
|
name: 'logger',
|
|
108
105
|
type: 'Logger',
|
|
109
106
|
decorators: [{ name: 'Inject', arguments: ['Logger'] }],
|
|
110
107
|
},
|
|
111
108
|
{
|
|
112
|
-
scope:
|
|
109
|
+
scope: Scope.Private,
|
|
113
110
|
isReadonly: true,
|
|
114
111
|
name: 'firestore',
|
|
115
112
|
type: 'Firestore',
|
|
@@ -121,5 +118,4 @@ function CrudClass(sourceFile, options) {
|
|
|
121
118
|
methods,
|
|
122
119
|
});
|
|
123
120
|
}
|
|
124
|
-
exports.CrudClass = CrudClass;
|
|
125
121
|
//# sourceMappingURL=crud-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"crud-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,KAAK,GAEN,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,UAAU,SAAS,CAAC,UAAsB,EAAE,OAAgB;IAChE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAEpD,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,2EAA2E;QAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC;QAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAC9B,UAAU,CAAC,eAAe,CAAC,CA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|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
function CreateDtoClass(sourceFile, options) {
|
|
1
|
+
import { CoerceClass } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
export function CreateDtoClass(sourceFile, options) {
|
|
7
4
|
const { classified, dtoName, camelized, collection, parentCollectionList } = options;
|
|
8
|
-
|
|
5
|
+
CoerceClass(sourceFile, `Create${dtoName}`, {
|
|
9
6
|
isExported: true,
|
|
10
7
|
extends: writer => {
|
|
11
8
|
writer.write('OmitType(');
|
|
12
9
|
writer.write(`${dtoName},`);
|
|
13
|
-
writer.write(`[ ${['id', ...parentCollectionList.map(pc =>
|
|
10
|
+
writer.write(`[ ${['id', ...parentCollectionList.map(pc => camelize(pc) + 'Id')].map(id => `'${id}'`)
|
|
14
11
|
.join()} ] as const`);
|
|
15
12
|
writer.write(')');
|
|
16
13
|
},
|
|
@@ -22,5 +19,4 @@ function CreateDtoClass(sourceFile, options) {
|
|
|
22
19
|
},
|
|
23
20
|
]);
|
|
24
21
|
}
|
|
25
|
-
exports.CreateDtoClass = CreateDtoClass;
|
|
26
22
|
//# sourceMappingURL=create-dto-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-dto-class.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/dto-class/create-dto-class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-dto-class.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/dto-class/create-dto-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,MAAM,UAAU,cAAc,CAAC,UAAsB,EAAE,OAAgB;IAErE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IAErF,WAAW,CAAC,UAAU,EAAE,SAAU,OAAQ,EAAE,EAAE;QAC5C,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,MAAM,CAAC,EAAE;YAChB,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC,GAAI,OAAQ,GAAG,CAAC,CAAC;YAC9B,MAAM,CAAC,KAAK,CAAC,KAAM,CAAE,IAAI,EAAE,GAAG,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAK,EAAG,GAAG,CAAC;iBACtB,IAAI,EAAG,aAAa,CAAC,CAAC;YAC1G,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;KACF,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC;QAC/B;YACE,YAAY,EAAE,CAAE,UAAU,CAAE;YAC5B,eAAe,EAAE,iBAAiB;SACnC;KACF,CAAC,CAAC;AAEL,CAAC"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const coerce_class_method_1 = require("../coerce-class-method");
|
|
8
|
-
const coerce_class_property_1 = require("../coerce-class-property");
|
|
9
|
-
function DtoClass(sourceFile, options) {
|
|
1
|
+
import { CoerceClass } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, Writers, } from 'ts-morph';
|
|
4
|
+
import { CoerceClassMethod } from '../coerce-class-method';
|
|
5
|
+
import { CoerceClassProperty } from '../coerce-class-property';
|
|
6
|
+
export function DtoClass(sourceFile, options) {
|
|
10
7
|
const { classified, dtoName, camelized, collection, parentCollectionList } = options;
|
|
11
|
-
const classDeclaration =
|
|
8
|
+
const classDeclaration = CoerceClass(sourceFile, dtoName, {
|
|
12
9
|
isExported: true,
|
|
13
10
|
});
|
|
14
|
-
|
|
11
|
+
CoerceClassProperty(classDeclaration, 'id', {
|
|
15
12
|
type: 'string',
|
|
16
|
-
scope:
|
|
13
|
+
scope: Scope.Public,
|
|
17
14
|
hasExclamationToken: true,
|
|
18
15
|
decorators: [
|
|
19
16
|
{
|
|
@@ -26,9 +23,9 @@ function DtoClass(sourceFile, options) {
|
|
|
26
23
|
],
|
|
27
24
|
});
|
|
28
25
|
for (const parentCollection of parentCollectionList) {
|
|
29
|
-
|
|
26
|
+
CoerceClassProperty(classDeclaration, camelize(parentCollection) + 'Id', {
|
|
30
27
|
type: 'string',
|
|
31
|
-
scope:
|
|
28
|
+
scope: Scope.Public,
|
|
32
29
|
hasExclamationToken: true,
|
|
33
30
|
decorators: [
|
|
34
31
|
{
|
|
@@ -41,16 +38,16 @@ function DtoClass(sourceFile, options) {
|
|
|
41
38
|
],
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
|
|
41
|
+
CoerceClassMethod(classDeclaration, `FromCreate${dtoName}`, {
|
|
45
42
|
isStatic: true,
|
|
46
|
-
scope:
|
|
43
|
+
scope: Scope.Public,
|
|
47
44
|
parameters: [
|
|
48
45
|
{
|
|
49
46
|
name: `create${dtoName}`,
|
|
50
47
|
type: `Create${dtoName}`,
|
|
51
48
|
},
|
|
52
49
|
...parentCollectionList.map(parentCollection => ({
|
|
53
|
-
name: `${
|
|
50
|
+
name: `${camelize(parentCollection)}Id`,
|
|
54
51
|
type: 'string',
|
|
55
52
|
})),
|
|
56
53
|
{
|
|
@@ -59,30 +56,30 @@ function DtoClass(sourceFile, options) {
|
|
|
59
56
|
initializer: 'uuid()',
|
|
60
57
|
},
|
|
61
58
|
],
|
|
62
|
-
statements:
|
|
59
|
+
statements: Writers.returnStatement(writer => {
|
|
63
60
|
writer.write('plainToClass(');
|
|
64
61
|
writer.writeLine(`${dtoName},`);
|
|
65
62
|
writer.writeLine('{');
|
|
66
63
|
writer.writeLine(`...classToPlain(create${dtoName}, CrudTransformOptions()),`);
|
|
67
64
|
writer.writeLine(`id: ${camelized}Id,`);
|
|
68
65
|
for (const parentCollection of parentCollectionList) {
|
|
69
|
-
writer.writeLine(`${
|
|
66
|
+
writer.writeLine(`${camelize(parentCollection)}Id,`);
|
|
70
67
|
}
|
|
71
68
|
writer.writeLine('},');
|
|
72
69
|
writer.writeLine('CrudTransformOptions()');
|
|
73
70
|
writer.write(');');
|
|
74
71
|
}),
|
|
75
72
|
});
|
|
76
|
-
|
|
73
|
+
CoerceClassMethod(classDeclaration, `FromUpdate${dtoName}`, {
|
|
77
74
|
isStatic: true,
|
|
78
|
-
scope:
|
|
75
|
+
scope: Scope.Public,
|
|
79
76
|
parameters: [
|
|
80
77
|
{
|
|
81
78
|
name: `update${dtoName}`,
|
|
82
79
|
type: `Update${dtoName}`,
|
|
83
80
|
},
|
|
84
81
|
...parentCollectionList.map(parentCollection => ({
|
|
85
|
-
name: `${
|
|
82
|
+
name: `${camelize(parentCollection)}Id`,
|
|
86
83
|
type: 'string',
|
|
87
84
|
})),
|
|
88
85
|
{
|
|
@@ -91,14 +88,14 @@ function DtoClass(sourceFile, options) {
|
|
|
91
88
|
initializer: 'uuid()',
|
|
92
89
|
},
|
|
93
90
|
],
|
|
94
|
-
statements:
|
|
91
|
+
statements: Writers.returnStatement(writer => {
|
|
95
92
|
writer.write('plainToClass(');
|
|
96
93
|
writer.writeLine(`${dtoName},`);
|
|
97
94
|
writer.writeLine('{');
|
|
98
95
|
writer.writeLine(`...classToPlain(update${dtoName}, CrudTransformOptions()),`);
|
|
99
96
|
writer.writeLine(`id: ${camelized}Id,`);
|
|
100
97
|
for (const parentCollection of parentCollectionList) {
|
|
101
|
-
writer.writeLine(`${
|
|
98
|
+
writer.writeLine(`${camelize(parentCollection)}Id,`);
|
|
102
99
|
}
|
|
103
100
|
writer.writeLine('},');
|
|
104
101
|
writer.writeLine('CrudTransformOptions()');
|
|
@@ -129,5 +126,4 @@ function DtoClass(sourceFile, options) {
|
|
|
129
126
|
},
|
|
130
127
|
]);
|
|
131
128
|
}
|
|
132
|
-
exports.DtoClass = DtoClass;
|
|
133
129
|
//# sourceMappingURL=dto-class.js.map
|