Skip to content

Commit

Permalink
fix: Update customization _id issue (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavda-bhavik authored Jun 8, 2023
2 parents f4b3580 + 4fe0fc4 commit ddfce41
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { FileMimeTypesEnum, createRecordFormat } from '@impler/shared';
import { ColumnRepository, TemplateRepository, CustomizationRepository } from '@impler/dal';
import { ColumnRepository, TemplateRepository, CustomizationRepository, CustomizationEntity } from '@impler/dal';
import { AddColumnCommand } from '../../commands/add-column.command';
import { StorageService } from '@impler/shared/dist/services/storage';
import { FileNameService } from '@shared/file/name.service';
Expand Down Expand Up @@ -36,11 +36,13 @@ export class AddColumn {
const customization = await this.customizationRepository.findOne({
_templateId,
});
customization.recordVariables = variables;
const updateData: Partial<CustomizationEntity> = {
recordVariables: variables,
};
if (!customization.isRecordFormatUpdated) {
customization.recordFormat = createRecordFormat(variables);
updateData.recordFormat = createRecordFormat(variables);
}
await this.customizationRepository.update({ _templateId }, customization);
await this.customizationRepository.update({ _templateId }, updateData);
}

async saveSampleFile(csvContent: string, templateId: string) {
Expand Down

0 comments on commit ddfce41

Please sign in to comment.