Skip to content

Commit

Permalink
feat: menstrual subscription scheduler (#218)
Browse files Browse the repository at this point in the history
menstrual subscription scheduler

/*
add path in tsconfig for simple path import
add path in jest config for simple path import
*/
  • Loading branch information
rubenkristian authored Nov 25, 2022
1 parent c350f13 commit 0d1a128
Show file tree
Hide file tree
Showing 170 changed files with 756 additions and 680 deletions.
18 changes: 11 additions & 7 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import { MailerModule } from '@nestjs-modules/mailer';
import { Module } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm';
import { LocationEntities, ProcessEnvModule, ProcessEnvProxy } from './common';
import { EscrowAccounts } from './common/escrow/models/deposit.entity';
import { IndexerModule } from './indexer/indexer.module';
import { EthereumListenerModule } from './listeners/ethereum-listener/ethereum-listener.module';
import { SubstrateListenerModule } from './listeners/substrate-listener/substrate-listener.module';
import { SchedulersModule } from './schedulers/schedulers.module';
import { keyList, SecretKeyList } from './common/secrets';
import {
LocationEntities,
ProcessEnvModule,
ProcessEnvProxy,
} from '@common/index';
import { EscrowAccounts } from '@common/escrow/models/deposit.entity';
import { IndexerModule } from '@indexer/indexer.module';
import { EthereumListenerModule } from '@listeners/ethereum-listener/ethereum-listener.module';
import { SubstrateListenerModule } from '@listeners/substrate-listener/substrate-listener.module';
import { SchedulersModule } from '@schedulers/schedulers.module';
import { keyList, SecretKeyList } from '@common/secrets';

// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();
Expand Down
2 changes: 1 addition & 1 deletion src/common/caches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
GCloudSecretManagerModule,
GCloudSecretManagerService,
} from '@debionetwork/nestjs-gcloud-secret-manager';
import { keyList, SecretKeyList } from '../../common/secrets';
import { keyList, SecretKeyList } from '@common/secrets';

require('dotenv').config(); // eslint-disable-line

Expand Down
2 changes: 1 addition & 1 deletion src/common/common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { ElasticsearchModule } from '@nestjs/elasticsearch';
import { keyList, SecretKeyList } from '../common/secrets';
import { keyList, SecretKeyList } from '@common/secrets';

// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();
Expand Down
2 changes: 1 addition & 1 deletion src/common/debio-conversion/debio-conversion.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GCloudSecretManagerModule } from '@debionetwork/nestjs-gcloud-secret-manager';
import { Module } from '@nestjs/common';
import { DebioConversionService } from './debio-conversion.service';
import { SecretKeyList } from '../../common/secrets';
import { SecretKeyList } from '@common/secrets';

@Module({
imports: [
Expand Down
2 changes: 1 addition & 1 deletion src/common/debio-conversion/debio-conversion.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { Injectable, Logger } from '@nestjs/common';
import axios from 'axios';
import { keyList } from '../../common/secrets';
import { keyList } from '@common/secrets';

@Injectable()
export class DebioConversionService {
Expand Down
2 changes: 1 addition & 1 deletion src/common/escrow/escrow.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { EscrowService } from './escrow.service';
import { EthereumModule, SubstrateModule } from '../index';
import { ErrorLoggingModule } from '../error-logging';
import { GCloudSecretManagerModule } from '@debionetwork/nestjs-gcloud-secret-manager';
import { SecretKeyList } from '../../common/secrets';
import { SecretKeyList } from '@common/secrets';

require('dotenv').config(); // eslint-disable-line
@Module({
Expand Down
2 changes: 1 addition & 1 deletion src/common/escrow/escrow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AsyncLock from 'async-lock';
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { ErrorLoggingService } from '../error-logging';
import { ErrorLoggingDto } from '../error-logging/dto/error-logging.dto';
import { keyList } from '../../common/secrets';
import { keyList } from '@common/secrets';

const lock = new AsyncLock();
const ESCROW_WALLET_LOCK_KEY = 'escrow-wallet-lock';
Expand Down
2 changes: 1 addition & 1 deletion src/common/ethereum/ethereum.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
GCloudSecretManagerModule,
GCloudSecretManagerService,
} from '@debionetwork/nestjs-gcloud-secret-manager';
import { SecretKeyList, keyList } from '../../common/secrets';
import { SecretKeyList, keyList } from '@common/secrets';

@Module({
imports: [
Expand Down
2 changes: 1 addition & 1 deletion src/common/ethereum/ethereum.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import escrowContract from './utils/Escrow.json';
import { ethers } from 'ethers';
import { CachesService } from '../caches';
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { keyList } from '../../common/secrets';
import { keyList } from '@common/secrets';

@Injectable()
export class EthereumService {
Expand Down
2 changes: 1 addition & 1 deletion src/common/mailer/mailer.manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { MailerService } from '@nestjs-modules/mailer';
import { Injectable, Logger } from '@nestjs/common';
import { keyList } from '../../common/secrets';
import { keyList } from '@common/secrets';
import { CustomerStakingRequestService, LabRegister } from './models';
import { NewOrderGA } from './models/new-order-ga.model';
import { NewOrderLab } from './models/new-order-lab.model';
Expand Down
2 changes: 1 addition & 1 deletion src/common/mailer/mailer.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handleba
import { Module } from '@nestjs/common';
import { join } from 'path';
import { MailerManager } from './mailer.manager';
import { SecretKeyList, keyList } from '../../common/secrets';
import { SecretKeyList, keyList } from '@common/secrets';

@Module({
imports: [
Expand Down
2 changes: 1 addition & 1 deletion src/common/substrate/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GCloudSecretManagerModule } from '@debionetwork/nestjs-gcloud-secret-manager';
import { Module } from '@nestjs/common';
import { SubstrateService } from './substrate.service';
import { SecretKeyList } from '../../common/secrets';
import { SecretKeyList } from '@common/secrets';

@Module({
imports: [
Expand Down
2 changes: 1 addition & 1 deletion src/common/substrate/substrate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApiPromise, Keyring, WsProvider } from '@polkadot/api';
import { Injectable, OnModuleInit, Logger } from '@nestjs/common';
import { waitReady } from '@polkadot/wasm-crypto';
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { keyList } from '../../common/secrets';
import { keyList } from '@common/secrets';

@Injectable()
export class SubstrateService implements OnModuleInit {
Expand Down
4 changes: 2 additions & 2 deletions src/indexer/indexer.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
DeleteAllIndexesCommand,
GetLastSubstrateBlockQueryIndexer,
} from './blocks';
import { ProcessEnvProxy } from '../common/proxies/process-env/process-env.proxy';
import { ProcessEnvProxy } from '@common/proxies/process-env/process-env.proxy';
import { ElasticsearchService } from '@nestjs/elasticsearch';
import { u32 } from '@polkadot/types';
import { SchedulerRegistry } from '@nestjs/schedule';
import { eventRoutes } from './indexer.routes';
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { keyList } from '../common/secrets';
import { keyList } from '@common/secrets';

@Injectable()
export class IndexerHandler
Expand Down
4 changes: 2 additions & 2 deletions src/indexer/indexer.module.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Module } from '@nestjs/common';
import { LabCommandHandlers } from './events/labs';
import { ServiceCommandHandlers } from './events/services';
import { CommonModule } from '../common/common.module';
import { CommonModule } from '@common/common.module';
import { BlockCommandHandlers, BlockQueryHandlers } from './blocks';
import { IndexerHandler } from './indexer.handler';
import { OrderCommandHandlers } from './events/orders';
import { GeneticTestingCommandHandlers } from './events/genetic-testing';
import { RequestServiceCommandHandlers } from './events/service-request';
import { CertificationsCommandHandlers } from './events/certifications';
import { ProcessEnvModule } from '../common/proxies/process-env/process-env.module';
import { ProcessEnvModule } from '@common/proxies/process-env/process-env.module';
import { GeneticDataCommandHandlers } from './events/genetic-data';
import { GeneticAnalystQualificationsCommandHandlers } from './events/genetic-analyst-qualifications';
import { GeneticAnalystServicesCommandHandlers } from './events/genetic-analyst-services';
Expand Down
6 changes: 3 additions & 3 deletions src/listeners/ethereum-listener/ethereum-listener.handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, OnModuleInit, Logger } from '@nestjs/common';
import { EthereumService } from '../../common/ethereum/ethereum.service';
import { EscrowService } from '../../common/escrow/escrow.service';
import { TransactionLoggingService } from '../../common';
import { EthereumService } from '@common/ethereum/ethereum.service';
import { EscrowService } from '@common/escrow/escrow.service';
import { TransactionLoggingService } from '@common/index';

@Injectable()
export class EthereumListenerHandler implements OnModuleInit {
Expand Down
8 changes: 4 additions & 4 deletions src/listeners/ethereum-listener/ethereum-listener.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Module } from '@nestjs/common';
import { EthereumModule } from '../../common/ethereum';
import { EscrowModule } from '../../common/escrow/escrow.module';
import { EthereumModule } from '@common/ethereum';
import { EscrowModule } from '@common/escrow/escrow.module';
import { EthereumListenerHandler } from './ethereum-listener.handler';
import { TransactionLoggingModule } from '../../common';
import { ErrorLoggingModule } from '../../common/error-logging';
import { TransactionLoggingModule } from '@common/index';
import { ErrorLoggingModule } from '@common/error-logging';

@Module({
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingService } from '../../../../../common';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingService } from '@common/index';
import { GeneticAnalysisOrderCancelledCommand } from './genetic-analysis-order-cancelled.command';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
NotificationService,
TransactionLoggingService,
} from '../../../../../common';
} from '@common/index';
import { GeneticAnalysisOrderFulfilledCommand } from './genetic-analysis-order-fulfilled.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';
import currencyUnit from '../../../models/currencyUnit';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
MailerManager,
NotificationService,
SubstrateService,
TransactionLoggingService,
} from '../../../../../common';
} from '@common/index';
import { GeneticAnalysisOrderPaidCommand } from './genetic-analysis-order-paid.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';
import {
queryGeneticAnalystByAccountId,
queryGeneticAnalystServicesByHashId,
} from '@debionetwork/polkadot-provider';
import { GCloudSecretManagerService } from '@debionetwork/nestjs-gcloud-secret-manager';
import { keyList } from '../../../../../common/secrets';
import { keyList } from '@common/secrets';

@Injectable()
@CommandHandler(GeneticAnalysisOrderPaidCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
NotificationService,
TransactionLoggingService,
} from '../../../../../common';
} from '@common/index';
import { GeneticAnalysisOrderRefundedCommand } from './genetic-analysis-order-refunded.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';
@Injectable()
@CommandHandler(GeneticAnalysisOrderRefundedCommand)
export class GeneticAnalysisOrderRefundedHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import {
TransactionLoggingService,
DateTimeProxy,
NotificationService,
} from '../../../../../common';
} from '@common/index';
import { GeneticAnalysisOrderCreatedCommand } from './genetic-analysis-order-created.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';

@Injectable()
@CommandHandler(GeneticAnalysisOrderCreatedCommand)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
DateTimeProxy,
NotificationService,
SubstrateService,
} from '../../../../../common';
} from '@common/index';
import { setGeneticAnalysisOrderRefunded } from '@debionetwork/polkadot-provider';
import { GeneticAnalysisRejectedCommand } from './genetic-analysis-rejected.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';

@Injectable()
@CommandHandler(GeneticAnalysisRejectedCommand)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
DateTimeProxy,
NotificationService,
SubstrateService,
} from '../../../../../common';
} from '@common/index';
import { setGeneticAnalysisOrderFulfilled } from '@debionetwork/polkadot-provider';
import { GeneticAnalysisResultReadyCommand } from './genetic-analysis-result-ready.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';

@Injectable()
@CommandHandler(GeneticAnalysisResultReadyCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DateTimeProxy, NotificationService } from '../../../../../common';
import { DateTimeProxy, NotificationService } from '@common/index';
import { GeneticAnalystServiceCreatedCommand } from './genetic-analyst-service-created.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';

@Injectable()
@CommandHandler(GeneticAnalystServiceCreatedCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { GeneticAnalystRegisteredCommand } from './genetic-analyst-registered.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { DateTimeProxy, NotificationService } from '../../../../../common';
import { NotificationDto } from '@common/notification/dto/notification.dto';
import { DateTimeProxy, NotificationService } from '@common/index';

@Injectable()
@CommandHandler(GeneticAnalystRegisteredCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
TransactionLoggingService,
} from '../../../../../common';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import { DateTimeProxy, TransactionLoggingService } from '@common/index';
import { GeneticAnalystStakedCommand } from './genetic-analyst-staked.command';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
TransactionLoggingService,
} from '../../../../../common';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import { DateTimeProxy, TransactionLoggingService } from '@common/index';
import { GeneticAnalystUnstakedCommand } from './genetic-analyst-unstaked.command';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';
import {
DateTimeProxy,
NotificationService,
TransactionLoggingService,
} from '../../../../../common';
} from '@common/index';
import { GeneticAnalystVerificationStatusCommand } from './genetic-analyst-verification-status.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { NotificationDto } from '@common/notification/dto/notification.dto';
import { VerificationStatus } from '@debionetwork/polkadot-provider/lib/primitives/verification-status';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
DebioConversionService,
TransactionLoggingService,
SubstrateService,
} from '../../../../../common';
} from '@common/index';
import {
convertToDbioUnitString,
queryOrderDetailByOrderID,
sendRewards,
} from '@debionetwork/polkadot-provider';
import { DataStakedCommand } from './data-staked.command';
import { TransactionLoggingDto } from '../../../../../common/transaction-logging/dto/transaction-logging.dto';
import { TransactionLoggingDto } from '@common/transaction-logging/dto/transaction-logging.dto';

@Injectable()
@CommandHandler(DataStakedCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Injectable, Logger } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DnaSampleRejectedCommand } from './dna-sample-rejected.command';
import { NotificationDto } from '../../../../../common/notification/dto/notification.dto';
import { DateTimeProxy, NotificationService } from '../../../../../common';
import { NotificationDto } from '@common/notification/dto/notification.dto';
import { DateTimeProxy, NotificationService } from '@common/index';

@Injectable()
@CommandHandler(DnaSampleRejectedCommand)
Expand Down
Loading

0 comments on commit 0d1a128

Please sign in to comment.