FIX: deprecating old pipeline routes

This commit is contained in:
Gabriel Rosa
2023-02-08 18:07:06 -03:00
parent 8043635b1c
commit 9fcbeda470
6 changed files with 171 additions and 52 deletions
+99 -37
View File
@@ -803,37 +803,6 @@
]
}
},
"/connections/connections-migration": {
"get": {
"operationId": "ConnectionController_synchronizeConnections",
"parameters": [
{
"name": "apply",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"tags": [
"connections"
],
"security": [
{
"access-token": []
},
{
"access-token": []
}
]
}
},
"/connections": {
"post": {
"operationId": "ConnectionController_createConnection",
@@ -2535,6 +2504,9 @@
"/pipelines/start/{id}": {
"post": {
"operationId": "PipelinesController_activate",
"summary": "",
"deprecated": true,
"description": "This method is deprecated. Please use route /pipelinesV2/start/:id instead",
"parameters": [],
"responses": {
"201": {
@@ -2564,6 +2536,9 @@
"/pipelines/{id}/status": {
"get": {
"operationId": "PipelinesController_getPipelineStatus",
"summary": "",
"deprecated": true,
"description": "This method is deprecated. Please use route /pipelinesV2/:id/status instead",
"parameters": [],
"responses": {
"200": {
@@ -2646,7 +2621,16 @@
"/pipelinesV2/download-logs": {
"get": {
"operationId": "PipelinesController_downloadLogs",
"parameters": [],
"parameters": [
{
"name": "pipeline_run_id",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
@@ -2700,6 +2684,32 @@
]
}
},
"/pipelinesV2/{id}/status": {
"get": {
"operationId": "PipelinesController_getPipelineStatus",
"parameters": [],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
},
"tags": [
"PipelinesV2"
],
"security": [
{
"access-token": []
}
]
}
},
"/pipelinesV2/{id}": {
"get": {
"operationId": "PipelinesController_findOne",
@@ -2725,7 +2735,7 @@
}
]
},
"put": {
"patch": {
"operationId": "PipelinesController_update",
"parameters": [],
"responses": {
@@ -2749,8 +2759,11 @@
}
]
},
"patch": {
"operationId": "PipelinesController_updateByPatch",
"put": {
"operationId": "PipelinesController_updateDeprecated",
"summary": "",
"deprecated": true,
"description": "This method is deprecated. Please use PATCH instead",
"parameters": [],
"responses": {
"200": {
@@ -2901,6 +2914,32 @@
]
}
},
"/pipelinesV2/start/{id}": {
"post": {
"operationId": "PipelinesController_activate",
"parameters": [],
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
},
"tags": [
"PipelinesV2"
],
"security": [
{
"access-token": []
}
]
}
},
"/inputs/available-entities/{plugin}": {
"get": {
"operationId": "InputsController_getAvailableEntities",
@@ -3984,7 +4023,7 @@
}
},
"info": {
"title": "Maestro - main",
"title": "Maestro - feat/docs-refactor",
"description": "Documentation for Maestro gateway",
"version": "1.0.0",
"contact": {}
@@ -6244,6 +6283,14 @@
},
"embed": {
"$ref": "#/components/schemas/EmbedObject"
},
"share_type": {
"type": "string",
"enum": [
"none",
"public",
"private"
]
}
},
"required": [
@@ -6558,11 +6605,26 @@
"message"
]
},
"CommentToDelete": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"username": {
"type": "string"
}
},
"required": [
"id",
"username"
]
},
"IDeleteComment": {
"type": "object",
"properties": {
"comment": {
"$ref": "#/components/schemas/IComment"
"$ref": "#/components/schemas/CommentToDelete"
}
},
"required": [
+4 -1
View File
@@ -560,7 +560,10 @@ export class CatalogController {
username,
});
const response = await this.catalogService.deleteComment(
{ data_asset_id: id, comment: body.comment },
{
data_asset_id: id,
comment: { ...body.comment, created_at: undefined, message: undefined },
},
metadata,
);
+6 -3
View File
@@ -1,4 +1,4 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ApiProperty, ApiPropertyOptional, PickType } from '@nestjs/swagger';
import { CreateDataAssetRequest } from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
export enum DataAssetShareType {
@@ -92,6 +92,8 @@ export class IDataAsset {
comments: IComment[];
@ApiPropertyOptional()
embed?: EmbedObject;
@ApiPropertyOptional({ enum: DataAssetShareType })
share_type?: DataAssetShareType;
}
export class IOneDataAsset {
@@ -104,9 +106,10 @@ export class IMakeAComment {
message: string;
}
export class CommentToDelete extends PickType(IComment, ['id', 'username']) {}
export class IDeleteComment {
@ApiProperty()
comment: IComment;
comment: CommentToDelete;
}
export class ICatalogAllResponse {
@@ -141,7 +144,7 @@ export class IUpdateDataRequest {
@ApiPropertyOptional()
embed: EmbedObject;
@ApiPropertyOptional({ enum: DataAssetShareType })
share_type: DataAssetShareType;
share_type?: DataAssetShareType;
}
export class ICreateDataAsset implements CreateDataAssetRequest {
@ApiProperty()
@@ -11,7 +11,7 @@ import {
Query,
UseFilters,
} from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { ApiExcludeEndpoint, ApiTags } from '@nestjs/swagger';
import { ConnectionClientService } from './client.service';
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import {
@@ -47,6 +47,7 @@ export class ConnectionController {
}
@Get('connections-migration')
@ApiExcludeEndpoint()
@RequireAllPermissions(
PERMISSIONS_GROUPS.DADOSFERA.permissions.CONNECTIONS_MIGRATION,
)
+11 -1
View File
@@ -1,5 +1,5 @@
import { Body, Controller, Get, Inject, Param, Post } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import {
AuthenticateCondition,
Authenticated,
@@ -42,6 +42,11 @@ export class PipelinesController {
}
@Post('start/:id')
@ApiOperation({
deprecated: true,
description:
'This method is deprecated. Please use route /pipelinesV2/start/:id instead',
})
async activate(@Param() params, @Body() body) {
const { id } = params;
const { info } = body;
@@ -60,6 +65,11 @@ export class PipelinesController {
}
@Get(':id/status')
@ApiOperation({
deprecated: true,
description:
'This method is deprecated. Please use route /pipelinesV2/:id/status instead',
})
async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params;
body.id = id;
@@ -14,10 +14,12 @@ import {
HttpStatus,
Patch,
HttpException,
BadRequestException,
} from '@nestjs/common';
import {
ApiCreatedResponse,
ApiNoContentResponse,
ApiOperation,
ApiTags,
} from '@nestjs/swagger';
import {
@@ -40,7 +42,6 @@ import {
IInitUploadCSVFile,
} from './interfaces';
import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter';
@UseFilters(new GrpcToHttpExceptionFilter())
@ApiTags('PipelinesV2')
@Controller('pipelinesV2')
@@ -135,15 +136,14 @@ export class PipelinesController {
async downloadLogs(
@User() user: RequestUser,
@Headers('Dadosfera-Lang') language,
@Query() query,
@Query('pipeline_run_id') pipeline_run_id: string,
) {
this.logger.info('PipelinesController - downloadLogs', { user });
if (!language) language = 'en-us';
if (!query) {
throw new HttpException('Query params not provided', 400);
}
if (!pipeline_run_id)
throw new BadRequestException('Missing pipeline_run_id');
const { customer_id, customer_name, user_id, username } = user;
const metadata = PackTheMetadata({
@@ -155,7 +155,7 @@ export class PipelinesController {
});
const url = await this.pipelinesClientService.downloadLogs(
query.pipeline_run_id,
pipeline_run_id,
metadata,
);
@@ -192,6 +192,24 @@ export class PipelinesController {
return this.pipelinesClientService.findOneObjects(id, metadata);
}
@Get(':id/status')
async getPipelineStatus(@Body() body, @Param() params) {
const { id } = params;
body.id = id;
this.logger.info(
process.env.DEV_URL + `/pipeline/${id} - ON GET PIPELINE STATUS ROUTE`,
{
user: body.info.user_id,
customer: body.info.customer,
},
);
const response = await this.oldPipelinesService.getPipelineStatus(body);
return response;
}
@Get('/:id')
async findOne(
@Headers('Dadosfera-Lang') language,
@@ -235,7 +253,7 @@ export class PipelinesController {
return result;
}
@Put('/:id')
@Patch('/:id')
async update(
@Headers('Dadosfera-Lang') language,
@Body() updatePipelineDto,
@@ -270,8 +288,12 @@ export class PipelinesController {
return response;
}
@Patch('/:id')
async updateByPatch(
@Put('/:id')
@ApiOperation({
deprecated: true,
description: 'This method is deprecated. Please use PATCH instead',
})
async updateDeprecated(
@Headers('Dadosfera-Lang') language,
@Body() updatePipelineDto,
@Param('id') id,
@@ -387,4 +409,22 @@ export class PipelinesController {
return pipeline;
}
@Post('start/:id')
async activate(@Param() params, @Body() body) {
const { id } = params;
const { info } = body;
this.logger.info(
process.env.DEV_URL + `/pipeline/start/${id} - ON START PIPELINE ROUTE`,
{
user: body.info.user_id,
customer: body.info.customer,
},
);
const response = await this.oldPipelinesService.runPipeline({ id, info });
return response;
}
}