Skip to content

Commit

Permalink
Merge pull request #4986 from novuhq/move-inbound-mail-parser-to-worker
Browse files Browse the repository at this point in the history
Refactor move inbound mail parser to worker
  • Loading branch information
Cliftonz authored Jan 30, 2024
2 parents 9baa945 + 5d8b78b commit 06f9154
Show file tree
Hide file tree
Showing 22 changed files with 377 additions and 216 deletions.
3 changes: 1 addition & 2 deletions apps/api/src/app/auth/usecases/login/login.usecase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import * as bcrypt from 'bcrypt';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { differenceInMinutes, parseISO } from 'date-fns';
import { UserRepository, UserEntity, OrganizationRepository } from '@novu/dal';
import { AnalyticsService, AuthService } from '@novu/application-generic';
import { AnalyticsService, AuthService, createHash } from '@novu/application-generic';

import { LoginCommand } from './login.command';
import { ApiException } from '../../../shared/exceptions/api.exception';
import { normalizeEmail } from '../../../shared/helpers/email-normalization.service';
import { createHash } from '../../../shared/helpers/hmac.service';

@Injectable()
export class Login {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import { Inject, Injectable } from '@nestjs/common';
import { OrganizationEntity, UserRepository } from '@novu/dal';
import * as bcrypt from 'bcrypt';
import { SignUpOriginEnum } from '@novu/shared';
import { AnalyticsService, AuthService } from '@novu/application-generic';
import { AnalyticsService, AuthService, createHash } from '@novu/application-generic';

import { UserRegisterCommand } from './user-register.command';
import { normalizeEmail } from '../../../shared/helpers/email-normalization.service';
import { ApiException } from '../../../shared/exceptions/api.exception';
import { CreateOrganization } from '../../../organization/usecases/create-organization/create-organization.usecase';
import { CreateOrganizationCommand } from '../../../organization/usecases/create-organization/create-organization.command';
import { createHash } from '../../../shared/helpers/hmac.service';

@Injectable()
export class UserRegister {
Expand Down
176 changes: 0 additions & 176 deletions apps/api/src/app/inbound-parse/e2e/inbound-email-parse.e2e.ts

This file was deleted.

4 changes: 1 addition & 3 deletions apps/api/src/app/inbound-parse/inbound-parse.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { CompileTemplate, WorkflowInMemoryProviderService } from '@novu/applicat

import { USE_CASES } from './usecases';
import { InboundParseController } from './inbound-parse.controller';
import { GetMxRecord } from './usecases/get-mx-record/get-mx-record.usecase';

import { SharedModule } from '../shared/shared.module';
import { AuthModule } from '../auth/auth.module';
import { InboundParseWorkerService } from './services/inbound-parse.worker.service';

const PROVIDERS = [GetMxRecord, CompileTemplate, InboundParseWorkerService];
const PROVIDERS = [CompileTemplate];

const memoryQueueService = {
provide: WorkflowInMemoryProviderService,
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/app/inbound-parse/usecases/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { InboundEmailParse } from './inbound-email-parse/inbound-email-parse.usecase';
import { GetMxRecord } from './get-mx-record/get-mx-record.usecase';

export const USE_CASES = [InboundEmailParse];
export const USE_CASES = [GetMxRecord];
8 changes: 0 additions & 8 deletions apps/api/src/app/shared/helpers/hmac.service.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as sinon from 'sinon';
import { UserSession } from '@novu/testing';
import { ChannelTypeEnum, ChatProviderIdEnum } from '@novu/shared';
import { IntegrationRepository, SubscriberRepository } from '@novu/dal';
import { createHash } from '../../shared/helpers/hmac.service';
import { createHash } from '@novu/application-generic';

const axiosInstance = axios.create();

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/subscribers/e2e/chat-oauth.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import axios from 'axios';
import { UserSession } from '@novu/testing';
import { ChannelTypeEnum, ChatProviderIdEnum } from '@novu/shared';
import { IntegrationRepository, SubscriberRepository } from '@novu/dal';
import { createHash } from '../../shared/helpers/hmac.service';
import { createHash } from '@novu/application-generic';

const axiosInstance = axios.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Injectable, NotFoundException } from '@nestjs/common';

import { ChannelTypeEnum } from '@novu/stateless';
import { IntegrationEntity, IntegrationRepository, EnvironmentRepository, ICredentialsEntity } from '@novu/dal';
import { createHash } from '@novu/application-generic';

import { ChatOauthCommand } from './chat-oauth.command';
import { createHash } from '../../../shared/helpers/hmac.service';
import { ApiException } from '../../../shared/exceptions/api.exception';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Injectable, NotFoundException, Logger } from '@nestjs/common';

import { UserRepository } from '@novu/dal';
import { createHash } from '@novu/application-generic';

import { GetMyProfileCommand } from './get-my-profile.dto';
import { createHash } from '../../../shared/helpers/hmac.service';
@Injectable()
export class GetMyProfileUsecase {
constructor(private readonly userRepository: UserRepository) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { IntegrationRepository } from '@novu/dal';
import { ChannelTypeEnum, InAppProviderIdEnum } from '@novu/shared';
import { UserSession } from '@novu/testing';
import { expect } from 'chai';
import { createHash } from '../../shared/helpers/hmac.service';
import {
buildIntegrationKey,
CacheInMemoryProviderService,
CacheService,
createHash,
InvalidateCacheService,
} from '@novu/application-generic';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import {
SelectIntegrationCommand,
SelectIntegration,
AuthService,
createHash,
} from '@novu/application-generic';

import { ApiException } from '../../../shared/exceptions/api.exception';
import { InitializeSessionCommand } from './initialize-session.command';

import { SessionInitializeResponseDto } from '../../dtos/session-initialize-response.dto';
import { createHash } from '../../../shared/helpers/hmac.service';

@Injectable()
export class InitializeSession {
Expand Down
8 changes: 0 additions & 8 deletions apps/worker/src/app/shared/utils/hmac.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/worker/src/app/shared/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './constants';
export * from './exceptions';
export * from './hmac';
export * from './cron-health';
Loading

0 comments on commit 06f9154

Please sign in to comment.