mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-08 22:19:07 +00:00
maestro connection with microservices - clients and modules
This commit is contained in:
@@ -1,8 +1,87 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { InputsClientService } from 'src/clients/inputs/client.service';
|
||||
|
||||
@Injectable()
|
||||
export class InputsService {
|
||||
check() {
|
||||
return { message: 'Ok' };
|
||||
|
||||
constructor( private inputClient: InputsClientService){}
|
||||
|
||||
|
||||
async create(data){
|
||||
|
||||
try{
|
||||
|
||||
const createInputResponse = await this.inputClient.create(data)
|
||||
|
||||
return createInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async findAll(){
|
||||
|
||||
try{
|
||||
|
||||
const findAllInputResponse = await this.inputClient.findAll({})
|
||||
|
||||
return findAllInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async findOne(id:string){
|
||||
|
||||
try{
|
||||
|
||||
const findOneInputResponse = await this.inputClient.findOne({id})
|
||||
return findOneInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
}
|
||||
|
||||
async update(id:string,data){
|
||||
|
||||
try{
|
||||
|
||||
const updateInputResponse = await this.inputClient.update({id,...data})
|
||||
|
||||
return updateInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
}
|
||||
|
||||
async remove(id:string){
|
||||
|
||||
try{
|
||||
const removeInputResponse = await this.inputClient.remove({id})
|
||||
|
||||
return removeInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
}
|
||||
|
||||
async testConnection(data){
|
||||
|
||||
try{
|
||||
|
||||
const testConnectionInputResponse = await this.inputClient.testConnection(data)
|
||||
|
||||
return testConnectionInputResponse;
|
||||
|
||||
}catch(err){
|
||||
throw new HttpException(err.message,HttpStatus.NOT_FOUND)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user