mirror of
https://gitlab.com/mobicoop/v3/service/ad.git
synced 2026-01-11 20:02:41 +00:00
use better constants
This commit is contained in:
@@ -8,6 +8,7 @@ import { RpcExceptionCode } from '@mobicoop/ddd-library';
|
||||
import { RpcValidationPipe } from '@mobicoop/ddd-library';
|
||||
import { CreateAdCommand } from '@modules/ad/core/application/commands/create-ad/create-ad.command';
|
||||
import { AdAlreadyExistsException } from '@modules/ad/core/domain/ad.errors';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
@@ -19,7 +20,7 @@ import { AdAlreadyExistsException } from '@modules/ad/core/domain/ad.errors';
|
||||
export class CreateAdGrpcController {
|
||||
constructor(private readonly commandBus: CommandBus) {}
|
||||
|
||||
@GrpcMethod('AdService', 'Create')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'Create')
|
||||
async create(data: CreateAdRequestDto): Promise<IdResponse> {
|
||||
try {
|
||||
const aggregateID: AggregateID = await this.commandBus.execute(
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AdMapper } from '@modules/ad/ad.mapper';
|
||||
import { NotFoundException } from '@mobicoop/ddd-library';
|
||||
import { RpcExceptionCode } from '@mobicoop/ddd-library';
|
||||
import { RpcValidationPipe } from '@mobicoop/ddd-library';
|
||||
import { GRPC_SERVICE_NAME } from '@src/app.constants';
|
||||
|
||||
@UsePipes(
|
||||
new RpcValidationPipe({
|
||||
@@ -23,7 +24,7 @@ export class FindAdByIdGrpcController {
|
||||
private readonly queryBus: QueryBus,
|
||||
) {}
|
||||
|
||||
@GrpcMethod('AdService', 'FindOneById')
|
||||
@GrpcMethod(GRPC_SERVICE_NAME, 'FindOneById')
|
||||
async findOnebyId(data: FindAdByIdRequestDto): Promise<AdResponseDto> {
|
||||
try {
|
||||
const ad: AdEntity = await this.queryBus.execute(
|
||||
|
||||
Reference in New Issue
Block a user