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

Commit

Permalink
feat: makes default workflow id optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Enngage committed Apr 8, 2020
1 parent 735997a commit cd6d03e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const restoreAsync = async (config: ICliFileConfig) => {
projectId: config.projectId,
apiKey: config.apiKey,
enableLog: config.enableLog,
workflowIdForImportedItems: '00000000-0000-0000-0000-000000000000',
workflowIdForImportedItems: undefined,
process: {
contentItem: item => {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/import/import.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { IProcessedItem, ItemType } from '../core';

export interface IImportConfig {
workflowIdForImportedItems: string;
workflowIdForImportedItems?: string;
projectId: string;
apiKey: string;
enableLog: boolean;
Expand Down
4 changes: 3 additions & 1 deletion src/import/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { IBinaryFile, IImportConfig, IImportSource } from './import.models';

export class ImportService {
private readonly defaultLanguageId: string = '00000000-0000-0000-0000-000000000000';
private readonly defaultWorkflowId: string = '00000000-0000-0000-0000-000000000000';
private readonly client: IManagementClient;

/**
Expand Down Expand Up @@ -576,7 +577,8 @@ export class ImportService {
idTranslateHelper.replaceIdReferencesWithNewId(languageVariant, currentItems);

// set workflow id (there is no API to create workflows programatically)
languageVariant.workflow_step.id = this.config.workflowIdForImportedItems;
const newWorkflowId: string = this.config.workflowIdForImportedItems ?? this.defaultWorkflowId;
languageVariant.workflow_step.id = newWorkflowId;

await this.client
.upsertLanguageVariant()
Expand Down

0 comments on commit cd6d03e

Please sign in to comment.