@@ -57,15 +57,15 @@ export class DatabaseManagementUc {
5757 /**
5858 * setup dir with json files
5959 */
60- private getSeedFolder ( ) {
60+ private getSeedFolder ( ) : string {
6161 return this . fileSystemAdapter . joinPath ( this . baseDir , 'setup' ) ;
6262 }
6363
6464 /**
6565 * export folder name based on current date
6666 * @returns
6767 */
68- private getTargetFolder ( toSeedFolder ?: boolean ) {
68+ private getTargetFolder ( toSeedFolder ?: boolean ) : string {
6969 if ( toSeedFolder === true ) {
7070 const targetFolder = this . getSeedFolder ( ) ;
7171 return targetFolder ;
@@ -118,7 +118,7 @@ export class DatabaseManagementUc {
118118 source : 'files' | 'database' ,
119119 folder : string ,
120120 collectionNameFilter ?: string [ ]
121- ) {
121+ ) : Promise < CollectionFilePath [ ] > {
122122 let allCollectionsWithFilePaths : CollectionFilePath [ ] = [ ] ;
123123
124124 // load all available collections from source
@@ -151,7 +151,7 @@ export class DatabaseManagementUc {
151151 return allCollectionsWithFilePaths ;
152152 }
153153
154- private async dropCollectionIfExists ( collectionName : string ) {
154+ private async dropCollectionIfExists ( collectionName : string ) : Promise < void > {
155155 const collectionExists = await this . databaseManagementService . collectionExists ( collectionName ) ;
156156 if ( collectionExists ) {
157157 // clear existing documents, if collection exists
@@ -162,7 +162,7 @@ export class DatabaseManagementUc {
162162 }
163163 }
164164
165- async seedDatabaseCollectionsFromFactories ( collections ?: string [ ] ) : Promise < string [ ] > {
165+ public async seedDatabaseCollectionsFromFactories ( collections ?: string [ ] ) : Promise < string [ ] > {
166166 const promises = generateSeedData ( ( s : string ) => this . injectEnvVars ( s ) )
167167 . filter ( ( data ) => {
168168 if ( collections && collections . length > 0 ) {
@@ -266,7 +266,7 @@ export class DatabaseManagementUc {
266266 * @param toSeedFolder optional override existing seed data files
267267 * @returns the list of collection names exported
268268 */
269- async exportCollectionsToFileSystem ( collections ?: string [ ] , toSeedFolder ?: boolean ) : Promise < string [ ] > {
269+ public async exportCollectionsToFileSystem ( collections ?: string [ ] , toSeedFolder ?: boolean ) : Promise < string [ ] > {
270270 const targetFolder = this . getTargetFolder ( toSeedFolder ) ;
271271 await this . fileSystemAdapter . createDir ( targetFolder ) ;
272272 // detect collections to export based on database collections
@@ -301,7 +301,7 @@ export class DatabaseManagementUc {
301301 /**
302302 * Updates the indexes in the database based on definitions in entities
303303 */
304- async syncIndexes ( ) : Promise < void > {
304+ public async syncIndexes ( ) : Promise < void > {
305305 await this . createUserSearchIndex ( ) ;
306306 return this . databaseManagementService . syncIndexes ( ) ;
307307 }
@@ -357,7 +357,7 @@ export class DatabaseManagementUc {
357357 return json ;
358358 }
359359
360- private resolvePlaceholder ( placeholder : string ) {
360+ private resolvePlaceholder ( placeholder : string ) : string {
361361 if ( Configuration . has ( placeholder ) ) {
362362 return Configuration . get ( placeholder ) as string ;
363363 }
@@ -369,13 +369,13 @@ export class DatabaseManagementUc {
369369 return '' ;
370370 }
371371
372- private encryptSecrets ( collectionName : string , jsonDocuments : unknown [ ] ) {
372+ private encryptSecrets ( collectionName : string , jsonDocuments : unknown [ ] ) : void {
373373 if ( collectionName === systemsCollectionName ) {
374374 this . encryptSecretsInSystems ( jsonDocuments as SystemEntity [ ] ) ;
375375 }
376376 }
377377
378- private encryptSecretsInSystems ( systems : SystemEntity [ ] ) {
378+ private encryptSecretsInSystems ( systems : SystemEntity [ ] ) : SystemEntity [ ] {
379379 systems . forEach ( ( system ) => {
380380 if ( system . oauthConfig ) {
381381 system . oauthConfig . clientSecret = this . defaultEncryptionService . encrypt ( system . oauthConfig . clientSecret ) ;
@@ -397,7 +397,7 @@ export class DatabaseManagementUc {
397397 * Manual replacement with the intend placeholders or value is mandatory.
398398 * Currently, this affects system and storageproviders collections.
399399 */
400- private removeSecrets ( collectionName : string , jsonDocuments : unknown [ ] ) {
400+ private removeSecrets ( collectionName : string , jsonDocuments : unknown [ ] ) : void {
401401 if ( collectionName === systemsCollectionName ) {
402402 this . removeSecretsFromSystems ( jsonDocuments as SystemEntity [ ] ) ;
403403 }
@@ -406,14 +406,14 @@ export class DatabaseManagementUc {
406406 }
407407 }
408408
409- private removeSecretsFromStorageproviders ( storageProviders : StorageProviderEntity [ ] ) {
409+ private removeSecretsFromStorageproviders ( storageProviders : StorageProviderEntity [ ] ) : void {
410410 storageProviders . forEach ( ( storageProvider ) => {
411411 storageProvider . accessKeyId = defaultSecretReplacementHintText ;
412412 storageProvider . secretAccessKey = defaultSecretReplacementHintText ;
413413 } ) ;
414414 }
415415
416- private removeSecretsFromSystems ( systems : SystemEntity [ ] ) {
416+ private removeSecretsFromSystems ( systems : SystemEntity [ ] ) : SystemEntity [ ] {
417417 systems . forEach ( ( system ) => {
418418 if ( system . oauthConfig ) {
419419 system . oauthConfig . clientSecret = defaultSecretReplacementHintText ;
@@ -428,16 +428,22 @@ export class DatabaseManagementUc {
428428 return systems ;
429429 }
430430
431+ public async migrationCreate ( ) : Promise < void > {
432+ await this . databaseManagementService . migrationCreate ( ) ;
433+ }
434+
431435 public async migrationUp ( from ?: string , to ?: string , only ?: string ) : Promise < void > {
432- return this . databaseManagementService . migrationUp ( from , to , only ) ;
436+ await this . databaseManagementService . migrationUp ( from , to , only ) ;
433437 }
434438
435439 public async migrationDown ( from ?: string , to ?: string , only ?: string ) : Promise < void > {
436- return this . databaseManagementService . migrationDown ( from , to , only ) ;
440+ await this . databaseManagementService . migrationDown ( from , to , only ) ;
437441 }
438442
439443 public async migrationPending ( ) : Promise < UmzugMigration [ ] > {
440- return this . databaseManagementService . migrationPending ( ) ;
444+ const result = await this . databaseManagementService . migrationPending ( ) ;
445+
446+ return result ;
441447 }
442448
443449 public encryptPlainText ( plainText : string ) : string {
0 commit comments