Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
feat: do not process content type if content type is not supposed to …
Browse files Browse the repository at this point in the history
…be exported
  • Loading branch information
Enngage committed Aug 6, 2020
1 parent d8dfd17 commit a463b6a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/export/export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ export class ExportService {
}

public async exportAllAsync(): Promise<IExportAllResult> {
const contentTypes = await this.exportContentTypesAsync();
const projectValidation = await this.exportProjectValidationAsync();

const exportItems = {
asset: this.config.exportFilter?.includes('asset') ?? true,
assetFolder: this.config.exportFilter?.includes('assetFolder') ?? true,
Expand All @@ -43,6 +40,9 @@ export class ExportService {
taxonomy: this.config.exportFilter?.includes('taxonomy') ?? true,
};

const contentTypes = await this.exportContentTypesAsync({processItem: exportItems.contentType});
const projectValidation = await this.exportProjectValidationAsync();

const data: IExportData = {
contentTypes: exportItems.contentType ? contentTypes : [],
contentTypeSnippets: exportItems.contentTypeSnippet ? await this.exportContentTypeSnippetsAsync() : [],
Expand Down Expand Up @@ -114,9 +114,11 @@ export class ExportService {
return response.data.items.map(m => m._raw);
}

public async exportContentTypesAsync(): Promise<ContentTypeContracts.IContentTypeContract[]> {
public async exportContentTypesAsync(data: {processItem: boolean}): Promise<ContentTypeContracts.IContentTypeContract[]> {
const response = await this.client.listContentTypes().toAllPromise();
response.data.items.forEach(m => this.processItem(m.name, 'contentType', m));
if (data.processItem) {
response.data.items.forEach(m => this.processItem(m.name, 'contentType', m));
}
return response.data.items.map(m => m._raw);
}

Expand Down

0 comments on commit a463b6a

Please sign in to comment.