-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from maick05/development
Development
- Loading branch information
Showing
166 changed files
with
7,192 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export enum EnumConfigAMQP { | ||
QUEUE = 'microservices.rabbitmq.queue', | ||
EVENT = 'microservices.rabbitmq.event', | ||
EXCHANGE = 'microservices.rabbitmq.exchange' | ||
EXCHANGE = 'microservices.rabbitmq.exchange', | ||
CHANNEL = 'microservices.rabbitmq.channel' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ConfigHelper } from '../../microservice/adapter/helper/config/config.helper'; | ||
import { EnumConfigAMQP } from './enum/enum-config-amqp.enumerator'; | ||
|
||
export const CHANNEL_SEED_NEIGHBORHOODS_BY_CITY = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.city', | ||
EnumConfigAMQP.CHANNEL | ||
); | ||
|
||
export const CHANNEL_SEED_NEIGHBORHOODS_BY_STATE = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.state', | ||
EnumConfigAMQP.CHANNEL | ||
); | ||
|
||
const DEFAULT_CHANNEL = CHANNEL_SEED_NEIGHBORHOODS_BY_CITY; | ||
|
||
const prefetchCount = ConfigHelper.getConfig( | ||
'prefetch-count', | ||
EnumConfigAMQP.CHANNEL | ||
); | ||
|
||
export const channelsConfig = mountChannels([ | ||
CHANNEL_SEED_NEIGHBORHOODS_BY_CITY, | ||
CHANNEL_SEED_NEIGHBORHOODS_BY_STATE | ||
]); | ||
|
||
function mountChannels(arr) { | ||
const channels = {}; | ||
arr.forEach((item) => { | ||
channels[item] = { | ||
prefetchCount, | ||
default: item === DEFAULT_CHANNEL | ||
}; | ||
}); | ||
return channels; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ConfigHelper } from '../../microservice/adapter/helper/config/config.helper'; | ||
import { EnumConfigAMQP } from './enum/enum-config-amqp.enumerator'; | ||
|
||
export const QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_CITY = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.city.process', | ||
EnumConfigAMQP.QUEUE | ||
); | ||
|
||
export const QUEUE_SEED_SUCCESS_NEIGHBORHOODS_BY_CITY = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.city.success', | ||
EnumConfigAMQP.QUEUE | ||
); | ||
|
||
export const QUEUE_SEED_ERROR_NEIGHBORHOODS_BY_CITY = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.city.error', | ||
EnumConfigAMQP.QUEUE | ||
); | ||
|
||
export const QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_STATE = ConfigHelper.getConfig( | ||
'seed.neighborhoods.by.state.process', | ||
EnumConfigAMQP.QUEUE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,49 @@ | ||
import { ConfigHelper } from '../../microservice/adapter/helper/config/config.helper'; | ||
import { EnumConfigAMQP } from './enum/enum-config-amqp.enumerator'; | ||
import { | ||
seedByCityError, | ||
seedByCityProcess, | ||
seedByCitySuccess | ||
CHANNEL_SEED_NEIGHBORHOODS_BY_CITY, | ||
CHANNEL_SEED_NEIGHBORHOODS_BY_STATE | ||
} from './rabbitmq-channels.config'; | ||
import { | ||
seedNeighborhoodsByCityError, | ||
seedNeighborhoodsByCityProcess, | ||
seedNeighborhoodsByCitySuccess, | ||
seedNeighborhoodsByStateProcess | ||
} from './rabbitmq-exchanges.config'; | ||
|
||
const QUEUE_SEED_MESSAGES = ConfigHelper.getConfig( | ||
'messages', | ||
EnumConfigAMQP.QUEUE | ||
); | ||
|
||
const QUEUE_SEED_SUCCESS = ConfigHelper.getConfig( | ||
'success', | ||
EnumConfigAMQP.QUEUE | ||
); | ||
|
||
const QUEUE_SEED_ERROR = ConfigHelper.getConfig('error', EnumConfigAMQP.QUEUE); | ||
import { | ||
QUEUE_SEED_ERROR_NEIGHBORHOODS_BY_CITY, | ||
QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_CITY, | ||
QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_STATE, | ||
QUEUE_SEED_SUCCESS_NEIGHBORHOODS_BY_CITY | ||
} from './rabbitmq-queues.config'; | ||
|
||
/* EXPORT */ | ||
export const routeKeySub = 'sub-1'; | ||
|
||
export const subscribeSeedByCityProcess = { | ||
exchange: seedByCityProcess, | ||
exchange: seedNeighborhoodsByCityProcess, | ||
routingKey: routeKeySub, | ||
queue: QUEUE_SEED_MESSAGES, | ||
queue: QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_CITY, | ||
queueOptions: { | ||
channel: 'channel-1' | ||
channel: CHANNEL_SEED_NEIGHBORHOODS_BY_CITY | ||
} | ||
}; | ||
|
||
export const subscribeSeedByCitySuccess = { | ||
exchange: seedByCitySuccess, | ||
exchange: seedNeighborhoodsByCitySuccess, | ||
routingKey: routeKeySub, | ||
queue: QUEUE_SEED_SUCCESS | ||
queue: QUEUE_SEED_SUCCESS_NEIGHBORHOODS_BY_CITY | ||
}; | ||
|
||
export const subscribeSeedByCityError = { | ||
exchange: seedByCityError, | ||
exchange: seedNeighborhoodsByCityError, | ||
routingKey: routeKeySub, | ||
queue: QUEUE_SEED_ERROR | ||
queue: QUEUE_SEED_ERROR_NEIGHBORHOODS_BY_CITY | ||
}; | ||
|
||
export const subscribeSeedByStateProcess = { | ||
exchange: seedNeighborhoodsByStateProcess, | ||
routingKey: routeKeySub, | ||
queue: QUEUE_SEED_MESSAGE_NEIGHBORHOODS_BY_STATE, | ||
queueOptions: { | ||
channel: CHANNEL_SEED_NEIGHBORHOODS_BY_STATE | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { CustomErrorException } from './custom-error.exception'; | ||
|
||
export class ResolutionException extends CustomErrorException { | ||
constructor( | ||
message: string, | ||
status: HttpStatus = HttpStatus.INTERNAL_SERVER_ERROR | ||
) { | ||
super(message, status, 6); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Controller, Get, HttpStatus, Param } from '@nestjs/common'; | ||
import { ApiExcludeController } from '@nestjs/swagger'; | ||
import { RegionsByCountryService } from '../../domain/service/regions/regions-by-country.service'; | ||
import { NestResponse } from '../../../core/http/nest-response'; | ||
import { AbstractController } from '../../domain/controller/abstract-controller'; | ||
import { SearchRegionsDTO } from '../../domain/model/search/regions/search-regions-dto.model'; | ||
|
||
@ApiExcludeController() | ||
@Controller('regions') | ||
export class RegionsController extends AbstractController { | ||
constructor( | ||
private readonly getRegionsByCountryService: RegionsByCountryService | ||
) { | ||
super(); | ||
} | ||
|
||
@Get('/:country') | ||
async getRegionsByCountry( | ||
@Param() params: SearchRegionsDTO | ||
): Promise<NestResponse> { | ||
return this.buildResponse( | ||
HttpStatus.OK, | ||
await this.getRegionsByCountryService.getFindAndSeedElements(params) | ||
); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/microservice/adapter/controller/resolutions.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Body, Controller, HttpStatus, Post } from '@nestjs/common'; | ||
import { NestResponse } from '../../../core/http/nest-response'; | ||
import { AbstractController } from '../../domain/controller/abstract-controller'; | ||
import { ApiExcludeController } from '@nestjs/swagger'; | ||
import { ReferenceResolution } from '../../domain/model/references/reference-resolution.model'; | ||
import { ResolutionService } from '../../domain/service/resolution/resolution.service'; | ||
|
||
@ApiExcludeController() | ||
@Controller('resolutions') | ||
export class ResolutionController extends AbstractController { | ||
constructor(private readonly resolutionService: ResolutionService) { | ||
super(); | ||
} | ||
|
||
@Post('/request') | ||
async requestResolution( | ||
@Body() msg: ReferenceResolution | ||
): Promise<NestResponse> { | ||
return this.buildResponse( | ||
HttpStatus.OK, | ||
await this.resolutionService.requestResolution(msg) | ||
); | ||
} | ||
} |
Oops, something went wrong.