maestro connection with microservices - clients and modules

This commit is contained in:
rodrigo.zamboni
2022-03-18 10:16:27 -03:00
parent e15a680b9f
commit 1523c6b4d1
25 changed files with 1668 additions and 639 deletions
+64 -3
View File
@@ -1,8 +1,69 @@
import { Injectable } from '@nestjs/common';
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { OutputsClientService } from 'src/clients/outputs/client.service';
@Injectable()
export class OutputsService {
check() {
return { message: 'Ok' };
constructor( private outputClient: OutputsClientService){}
async create(createOutputDto){
try{
const createOutputResponse = await this.outputClient.create(createOutputDto);
return createOutputResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async findOne(id:string){
try{
const findOneOutputResponse = await this.outputClient.findOne({id});
return findOneOutputResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async findAll(){
try{
const findAllOutputResponse = await this.outputClient.findAll();
return findAllOutputResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async update(id:string, data){
try{
const updateOutputResponse = await this.outputClient.update({id,...data});
return updateOutputResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async remove(id:string){
try{
const removeOutputResponse = await this.outputClient.remove({id});
return removeOutputResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
}