@@ -190,10 +190,10 @@ function askForFieldsToRemove() {
190190 this . prompt ( prompts ) . then ( props => {
191191 if ( props . confirmRemove ) {
192192 this . log ( chalk . red ( `\nRemoving fields: ${ props . fieldsToRemove } \n` ) ) ;
193- for ( let i = context . fields . length - 1 ; i >= 0 ; i -= 1 ) {
194- const field = context . fields [ i ] ;
193+ for ( let i = this . entityConfig . fields . length - 1 ; i >= 0 ; i -= 1 ) {
194+ const field = this . entityConfig . fields [ i ] ;
195195 if ( props . fieldsToRemove . filter ( val => val === field . fieldName ) . length > 0 ) {
196- context . fields . splice ( i , 1 ) ;
196+ this . entityConfig . fields . splice ( i , 1 ) ;
197197 }
198198 }
199199 }
@@ -246,10 +246,10 @@ function askForRelationsToRemove() {
246246 this . prompt ( prompts ) . then ( props => {
247247 if ( props . confirmRemove ) {
248248 this . log ( chalk . red ( `\nRemoving relationships: ${ props . relsToRemove } \n` ) ) ;
249- for ( let i = context . relationships . length - 1 ; i >= 0 ; i -= 1 ) {
250- const rel = context . relationships [ i ] ;
249+ for ( let i = this . entityConfig . relationships . length - 1 ; i >= 0 ; i -= 1 ) {
250+ const rel = this . entityConfig . relationships [ i ] ;
251251 if ( props . relsToRemove . filter ( val => val === `${ rel . relationshipName } :${ rel . relationshipType } ` ) . length > 0 ) {
252- context . relationships . splice ( i , 1 ) ;
252+ this . entityConfig . relationships . splice ( i , 1 ) ;
253253 }
254254 }
255255 }
@@ -265,8 +265,8 @@ function askForTableName() {
265265 const skipCheckLengthOfIdentifier = context . skipCheckLengthOfIdentifier ;
266266 if (
267267 skipCheckLengthOfIdentifier ||
268- ! context . relationships ||
269- context . relationships . length === 0 ||
268+ ! this . entityConfig . relationships ||
269+ this . entityConfig . relationships . length === 0 ||
270270 entityTableName . length <= 30
271271 /* (prodDatabaseType === 'oracle' && entityTableName.length > 14) || */
272272 ) {
@@ -308,7 +308,7 @@ function askForTableName() {
308308/* function askForFiltering() {
309309 const context = this.context;
310310 // don't prompt if server is skipped, or the backend is not sql, or no service requested
311- if (context.useConfigurationFile || context.skipServer || context.databaseType !== 'sql' || context .service === 'no') {
311+ if (context.useConfigurationFile || context.skipServer || context.databaseType !== 'sql' || this.entityConfig .service === 'no') {
312312 return;
313313 }
314314 const done = this.async();
@@ -339,7 +339,7 @@ function askForTableName() {
339339function askForDTO ( ) {
340340 const context = this . context ;
341341 // don't prompt if data is imported from a file or server is skipped or if no service layer
342- if ( context . useConfigurationFile || context . skipServer || context . service === 'no' ) {
342+ if ( context . useConfigurationFile || context . skipServer || this . entityConfig . service === 'no' ) {
343343 context . dto = context . dto || 'no' ;
344344 return ;
345345 }
@@ -363,7 +363,7 @@ function askForDTO() {
363363 } ,
364364 ] ;
365365 this . prompt ( prompts ) . then ( props => {
366- context . dto = props . dto ;
366+ this . entityConfig . dto = props . dto ;
367367 done ( ) ;
368368 } ) ;
369369}
@@ -394,7 +394,7 @@ function askForService() {
394394 } ,
395395 ] ;
396396 this . prompt ( prompts ) . then ( props => {
397- context . service = props . service ;
397+ this . entityConfig . service = props . service ;
398398 done ( ) ;
399399 } ) ;
400400}
@@ -432,7 +432,7 @@ function askForPagination() {
432432 } ,
433433 ] ;
434434 this . prompt ( prompts ) . then ( props => {
435- context . pagination = props . pagination ;
435+ this . entityConfig . pagination = props . pagination ;
436436 this . log ( chalk . green ( '\nEverything is configured, generating the entity...\n' ) ) ;
437437 done ( ) ;
438438 } ) ;
0 commit comments