mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-14 07:09:08 +00:00
34 lines
985 B
TypeScript
34 lines
985 B
TypeScript
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
|
import { PipelinesClientService } from './client.service';
|
|
import { IIdRequest } from './interfaces';
|
|
import { objectCamelToSnake } from 'src/utils/CaseConverter';
|
|
|
|
@Injectable()
|
|
export class PipelinesService {
|
|
constructor(private pipelineClient: PipelinesClientService) {}
|
|
|
|
async getPipelineStatus(data: IIdRequest) {
|
|
try {
|
|
const pipelineStatusResponse =
|
|
await this.pipelineClient.getPipelineStatus(data);
|
|
|
|
return objectCamelToSnake(pipelineStatusResponse);
|
|
} catch (err) {
|
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
|
}
|
|
}
|
|
|
|
async runPipeline({ id, info }: IIdRequest) {
|
|
try {
|
|
const triggerPipelineResponse = await this.pipelineClient.runPipeline({
|
|
id,
|
|
info,
|
|
});
|
|
|
|
return objectCamelToSnake(triggerPipelineResponse);
|
|
} catch (err) {
|
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
|
}
|
|
}
|
|
}
|