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
+98 -7
View File
@@ -1,8 +1,99 @@
// import { Injectable } from '@nestjs/common';
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { PipelinesClientService } from 'src/clients/pipelines/client.service';
import { objectCamelToSnake } from 'src/utils/CaseConverter';
// @Injectable()
// export class PipelinesService {
// check() {
// return { message: 'Ok' };
// }
// }
@Injectable()
export class PipelinesService {
constructor( private pipelineClient: PipelinesClientService){}
async create(createPipelineDto){
try{
const createPipelineResponse = await this.pipelineClient.create(createPipelineDto);
return objectCamelToSnake(createPipelineResponse)
}catch(err){
console.log(err)
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async findOne(id:string){
try{
const findOnePipelineResponse = await this.pipelineClient.findOne({id});
return objectCamelToSnake(findOnePipelineResponse)
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async findAll(){
try{
const findAllPipelineResponse = await this.pipelineClient.findAll();
return objectCamelToSnake(findAllPipelineResponse)
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async update(id:string, data){
try{
const updatePipelineResponse = await this.pipelineClient.update({id,...data});
return objectCamelToSnake(updatePipelineResponse)
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async remove(id:string){
try{
const removePipelineResponse = await this.pipelineClient.remove({id});
return removePipelineResponse
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async getPipelineLogsMessages(id:string,details:string){
try{
const pipelineLogsResponse = await this.pipelineClient.getPipelineLogsMessages({id,details});
return objectCamelToSnake(pipelineLogsResponse)
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
async getPipelineStatus(id:string){
try{
const pipelineStatusResponse = await this.pipelineClient.getPipelineStatus({id});
return objectCamelToSnake(pipelineStatusResponse)
}catch(err){
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
}
}
}