mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-12 18:29:09 +00:00
Merge branch 'on-tests' into ci/cd
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { TransformationsController } from './transformations.controller';
|
||||
import { TransformationGrpcClientService } from './transformations.service';
|
||||
import { TransformationsService } from './transformations.service';
|
||||
|
||||
describe('TransformationsController', () => {
|
||||
let controller: TransformationsController;
|
||||
@@ -8,10 +8,12 @@ describe('TransformationsController', () => {
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [TransformationsController],
|
||||
providers: [TransformationGrpcClientService],
|
||||
providers: [TransformationsService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<TransformationsController>(TransformationsController);
|
||||
controller = module.get<TransformationsController>(
|
||||
TransformationsController,
|
||||
);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
import { Controller, Delete, Get, OnModuleInit, Param, Post, Put } from '@nestjs/common';
|
||||
import { Client, ClientGrpc, MessagePattern, Payload } from '@nestjs/microservices';
|
||||
import { TransformationGrpcClientService } from './transformations.service';
|
||||
import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
OnModuleInit,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
Client,
|
||||
ClientGrpc,
|
||||
MessagePattern,
|
||||
Payload,
|
||||
} from '@nestjs/microservices';
|
||||
import { TransformationsService } from './transformations.service';
|
||||
import { CreateTransformationDto } from './dto/create-transformation.dto';
|
||||
import { UpdateTransformationDto } from './dto/update-transformation.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
@@ -12,17 +25,22 @@ export class TransformationsController implements OnModuleInit {
|
||||
@Client(GrpcClientConfiguration)
|
||||
private transformationServiceClient: ClientGrpc;
|
||||
|
||||
private transformationService: TransformationGrpcClientService;
|
||||
private transformationService: TransformationsService;
|
||||
|
||||
onModuleInit() {
|
||||
this.transformationService =
|
||||
this.transformationServiceClient.getService<TransformationGrpcClientService>('TransformationService');
|
||||
this.transformationServiceClient.getService<TransformationsService>(
|
||||
'TransformationService',
|
||||
);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Payload() createTransformationDto: CreateTransformationDto[]) {
|
||||
|
||||
return createTransformationDto.map( transf => this.transformationService.create(transf))
|
||||
return createTransformationDto.map((transf) =>
|
||||
this.transformationService.create(transf),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Get()
|
||||
@@ -36,7 +54,10 @@ export class TransformationsController implements OnModuleInit {
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
update(@Param() id:string,@Payload() updateTransformationDto: UpdateTransformationDto) {
|
||||
update(
|
||||
@Param() id: string,
|
||||
@Payload() updateTransformationDto: UpdateTransformationDto,
|
||||
) {
|
||||
return this.transformationService.update(id, updateTransformationDto);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CreateTransformationDto } from './dto/create-transformation.dto';
|
||||
import { UpdateTransformationDto } from './dto/update-transformation.dto';
|
||||
|
||||
@Injectable()
|
||||
export class TransformationGrpcClientService {
|
||||
export class TransformationsService {
|
||||
create(createTransformationDto: CreateTransformationDto) {
|
||||
return 'This action adds a new transformation';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user