Skip to content

Commit

Permalink
added liquiditydonor as new Broker Types
Browse files Browse the repository at this point in the history
  • Loading branch information
egerj committed Apr 8, 2021
1 parent 574b331 commit 7c426fd
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
35 changes: 20 additions & 15 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { BullModule } from '@nestjs/bull';
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { MongooseModule } from '@nestjs/mongoose';
import { ScheduleModule } from '@nestjs/schedule';
import { AppController } from './app.controller';
import { BrokerModule } from './broker/broker.module';
import { ClearingModule } from './clearing/clearing.module';
import { InvoiceModule } from './invoice/invoice.module';
import { MarketModule } from './market/market.module';
import { MSSocket } from './MSSocket';
import { OrderModule } from './order/order.module';
import { Order, OrderSchema } from './order/schemas/Order.schema';
import { OrderbookModule } from './orderbook/orderbook.module';
import { PricingModule } from './pricing/pricing.module';
import { QueueModule } from './queue/queue.module';
import { ShareModule } from './share/share.module';
import { InvoiceModule } from './invoice/invoice.module';

@Module({
imports: [
Expand All @@ -24,25 +29,25 @@ import { InvoiceModule } from './invoice/invoice.module';
},
}),
MongooseModule.forFeature([{ name: Order.name, schema: OrderSchema }]),
// BullModule.forRootAsync({
// inject: [ConfigService],
// useFactory: (configService: ConfigService) => ({
// redis: {
// host: configService.get('REDIS_HOST'),
// port: configService.get('REDIS_PORT'),
// password: configService.get('REDIS_PW'),
// },
// }),
// }),
// OrderModule,
// QueueModule,
BullModule.forRootAsync({
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
redis: {
host: configService.get('REDIS_HOST'),
port: configService.get('REDIS_PORT'),
password: configService.get('REDIS_PW'),
},
}),
}),
OrderModule,
QueueModule,
BrokerModule,
ShareModule,
ClearingModule,
// MarketModule,
MarketModule,
PricingModule,
InvoiceModule,
// OrderbookModule,
OrderbookModule,
],
controllers: [AppController],
providers: [MSSocket],
Expand Down
8 changes: 6 additions & 2 deletions src/broker/BrokerValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ export class BrokerValidator {
throw new UnprocessableEntityException('Please provide a broker type');
}

if (!['business', 'private', 'simulation', ...eT].includes(type)) {
if (
!['business', 'private', 'simulation', 'liquiditydonor', ...eT].includes(
type,
)
) {
throw new UnprocessableEntityException(
'Invalid broker type. Valid types are: business, private, simulation',
'Invalid broker type. Valid types are: business, private, simulation, liquiditydonor.',
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/broker/dtos/CreateBroker.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class CreateBrokerDto {
type: 'BrokerType',
example: 'business',
})
type: 'private' | 'business' | 'simulation';
type: 'private' | 'business' | 'simulation' | 'liquiditydonor';

@ApiProperty({
description: 'Internal displayName for an specific broker',
Expand Down
7 changes: 6 additions & 1 deletion src/broker/models/Broker.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export class BrokerModel {
type: 'BrokerType',
example: 'private',
})
type: 'private' | 'business' | 'simulation' | 'stockmarket';
type:
| 'private'
| 'business'
| 'simulation'
| 'stockmarket'
| 'liquiditydonor';

@ApiProperty({
description: 'Internal displayName for an specific broker',
Expand Down
7 changes: 6 additions & 1 deletion src/broker/schemas/Broker.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export class Broker extends Document {
example: 'business',
})
@Prop()
type: 'private' | 'business' | 'simulation' | 'stockmarket';
type:
| 'private'
| 'business'
| 'simulation'
| 'stockmarket'
| 'liquiditydonor';

@ApiProperty({
description: 'Internal displayName for an specific broker',
Expand Down

0 comments on commit 7c426fd

Please sign in to comment.