Fix seeds for local workspace and newly created workspaces (#2333)

* Update metadata/data seeds

* fix

* fix

* move seeding into a transaction

* add no-non-null-assertion

---------

Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
Weiko
2023-11-03 14:33:45 +01:00
committed by GitHub
parent 56a5f99108
commit b56f6f3947
33 changed files with 1392 additions and 630 deletions

View File

@ -1,7 +1,6 @@
import { Command, CommandRunner, Option } from 'nest-commander';
import { ObjectMetadataService } from 'src/metadata/object-metadata/services/object-metadata.service';
import { TenantInitialisationService } from 'src/metadata/tenant-initialisation/tenant-initialisation.service';
import { DataSourceMetadataService } from 'src/metadata/data-source-metadata/data-source-metadata.service';
// TODO: implement dry-run
@ -17,7 +16,6 @@ export class SyncTenantMetadataCommand extends CommandRunner {
constructor(
private readonly objectMetadataService: ObjectMetadataService,
private readonly dataSourceMetadataService: DataSourceMetadataService,
private readonly tenantInitialisationService: TenantInitialisationService,
) {
super();
}
@ -37,8 +35,7 @@ export class SyncTenantMetadataCommand extends CommandRunner {
workspaceId: { eq: options.workspaceId },
});
// TODO: this should not be the responsibility of tenantInitialisationService.
await this.tenantInitialisationService.createObjectsAndFieldsMetadata(
await this.objectMetadataService.createStandardObjectsAndFieldsMetadata(
dataSourceMetadata.id,
options.workspaceId,
);