hunk.code_window:       )
       )[0];
       const overrides = command.overrides[integration.providerId] || {};
       let subject = '';
       let content: string | IEmailBlock[] = '';
       try {
  
hunk.labels: keep keep keep replace keep keep keep keep
hunk.after_edit:     const overrides = command.overrides[integration?.providerId] || {};
  
hunk.file_path: apps/api/src/app/events/usecases/send-message/send-message-email.usecase.ts
hunk.type: replace
file: import { Injectable } from '@nestjs/common';
  import { IntegrationEntity, IntegrationRepository } from '@novu/dal';
  import { GetDecryptedIntegrationsCommand } from './get-decrypted-integrations.command';
  import { decryptCredentials } from '../../../shared/services/encryption';
  
  @Injectable()
  export class GetDecryptedIntegrations {
    constructor(private integrationRepository: IntegrationRepository) {}
  
    async execute(command: GetDecryptedIntegrationsCommand): Promise<IntegrationEntity[]> {
      const query: Partial<IntegrationEntity> = {
        _environmentId: command.environmentId,
      };
  
      if (command.active) {
        query.active = command.active;
      }
  
      if (command.channelType) {
        query.channel = command.channelType;
      }
  
      if (command.providerId) {
        query.providerId = command.providerId;
      }
  
      const integrations = command.findOne
        ? [await this.integrationRepository.findOne(query)]
        : await this.integrationRepository.find(query);
  
      return integrations.map((integration: IntegrationEntity) => {
        integration.credentials = decryptCredentials(integration.credentials);
  
        return integration;
      });
    }
  }
  