mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-23 19:29:09 +00:00
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import {
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
OnModuleInit,
|
|
Param,
|
|
Post,
|
|
Put,
|
|
} from '@nestjs/common';
|
|
import {
|
|
Client,
|
|
ClientGrpc,
|
|
MessagePattern,
|
|
Payload,
|
|
} from '@nestjs/microservices';
|
|
import { OutputsService } from './outputs.service';
|
|
import { CreateOutputDto } from './dto/create-output.dto';
|
|
import { UpdateOutputDto } from './dto/update-output.dto';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { GrpcClientConfiguration } from './config/grpc-client';
|
|
|
|
@Controller('output')
|
|
export class OutputsController implements OnModuleInit {
|
|
@Client(GrpcClientConfiguration)
|
|
private outputServiceClient: ClientGrpc;
|
|
|
|
private outputService: OutputsService;
|
|
|
|
onModuleInit() {
|
|
this.outputService =
|
|
this.outputServiceClient.getService<OutputsService>('OutputService');
|
|
}
|
|
@Post()
|
|
create(@Payload() createOutputDto: CreateOutputDto) {
|
|
return this.outputService.create(createOutputDto);
|
|
}
|
|
|
|
@Get()
|
|
list() {
|
|
return this.outputService.list();
|
|
}
|
|
|
|
@Get(':id')
|
|
show(@Param() id: string) {
|
|
return this.outputService.show(id);
|
|
}
|
|
|
|
@Put(':id')
|
|
update(@Param() id: string, @Payload() updateOutputDto: UpdateOutputDto) {
|
|
return this.outputService.update(id, updateOutputDto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(@Param() id: string) {
|
|
return this.outputService.remove(id);
|
|
}
|
|
}
|