diff --git a/docsfera.json b/docsfera.json index ca5784f..a26017e 100644 --- a/docsfera.json +++ b/docsfera.json @@ -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": [ diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 3a29107..d9ba418 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -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, ); diff --git a/src/modules/catalog/dtos/index.ts b/src/modules/catalog/dtos/index.ts index e55872f..945e04d 100644 --- a/src/modules/catalog/dtos/index.ts +++ b/src/modules/catalog/dtos/index.ts @@ -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() diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index 67d5c3e..4ea8897 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -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, ) diff --git a/src/modules/pipelines/pipelines.controller.ts b/src/modules/pipelines/pipelines.controller.ts index 776cd65..3eb334b 100644 --- a/src/modules/pipelines/pipelines.controller.ts +++ b/src/modules/pipelines/pipelines.controller.ts @@ -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; diff --git a/src/modules/pipelinesV2/pipelines.controller.ts b/src/modules/pipelinesV2/pipelines.controller.ts index 7552cb4..521251b 100644 --- a/src/modules/pipelinesV2/pipelines.controller.ts +++ b/src/modules/pipelinesV2/pipelines.controller.ts @@ -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; + } }