From 8043635b1cb89c0c8a70889bb440a02615e646ce Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 8 Feb 2023 15:23:49 -0300 Subject: [PATCH 01/19] FIX: add authentication to swagger --- docsfera.json | 616 +++++++++++++++++- .../authentication.decorator.ts | 22 +- src/authentication/authentication.guard.ts | 7 +- src/main.ts | 9 +- src/modules/auth/auth.controller.ts | 3 +- src/modules/catalog/catalog.controller.ts | 1 - .../connection/connection.controller.ts | 3 +- src/modules/connector/connector.controller.ts | 3 +- .../productboard/productboard.controller.ts | 2 + 9 files changed, 621 insertions(+), 45 deletions(-) diff --git a/docsfera.json b/docsfera.json index 4a9cad2..ca5784f 100644 --- a/docsfera.json +++ b/docsfera.json @@ -63,6 +63,11 @@ }, "tags": [ "Auth" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -285,6 +290,14 @@ }, "tags": [ "Auth" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -319,7 +332,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -369,7 +385,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -398,7 +417,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -417,7 +439,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -443,7 +468,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -479,7 +507,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -515,7 +546,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -549,7 +583,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -585,7 +622,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -623,7 +663,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -661,7 +704,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -698,6 +744,11 @@ }, "tags": [ "Permissions" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -775,7 +826,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] } @@ -811,7 +865,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -835,7 +892,7 @@ ], "security": [ { - "bearer": [] + "access-token": [] } ] } @@ -888,7 +945,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -921,7 +981,10 @@ ], "security": [ { - "bearer": [] + "access-token": [] + }, + { + "access-token": [] } ] }, @@ -945,7 +1008,7 @@ ], "security": [ { - "bearer": [] + "access-token": [] } ] } @@ -982,6 +1045,11 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + } ] }, "post": { @@ -1025,6 +1093,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1060,6 +1136,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1095,6 +1179,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1130,6 +1222,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1173,6 +1273,11 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + } ] }, "delete": { @@ -1214,6 +1319,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "patch": { @@ -1265,6 +1378,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1310,6 +1431,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1353,6 +1482,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1404,6 +1541,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "put": { @@ -1447,6 +1592,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1492,6 +1645,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1545,6 +1706,14 @@ }, "tags": [ "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1614,6 +1783,11 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + } ] }, "post": { @@ -1657,6 +1831,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1702,6 +1884,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "delete": { @@ -1745,6 +1935,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "patch": { @@ -1788,6 +1986,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1833,6 +2039,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1876,6 +2090,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "delete": { @@ -1917,6 +2139,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "patch": { @@ -1968,6 +2198,14 @@ }, "tags": [ "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -1989,6 +2227,11 @@ }, "tags": [ "Network Config" + ], + "security": [ + { + "access-token": [] + } ] }, "post": { @@ -2028,6 +2271,14 @@ }, "tags": [ "Network Config" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2058,6 +2309,11 @@ }, "tags": [ "Network Config" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2088,6 +2344,11 @@ }, "tags": [ "Network Config" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2119,6 +2380,11 @@ }, "tags": [ "Connection Test" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2150,6 +2416,11 @@ }, "tags": [ "Connection Test" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2181,6 +2452,11 @@ }, "tags": [ "Connection Test" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2212,6 +2488,11 @@ }, "tags": [ "Connection Test" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2243,6 +2524,11 @@ }, "tags": [ "Connection Test" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2264,6 +2550,14 @@ }, "tags": [ "Pipelines" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2285,6 +2579,14 @@ }, "tags": [ "Pipelines" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2316,6 +2618,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] }, "get": { @@ -2328,6 +2635,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2342,6 +2654,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2356,6 +2673,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2370,6 +2692,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2391,6 +2718,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] }, "put": { @@ -2410,6 +2742,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] }, "patch": { @@ -2429,6 +2766,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] }, "delete": { @@ -2441,6 +2783,11 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2465,6 +2812,14 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2496,6 +2851,14 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2527,6 +2890,14 @@ }, "tags": [ "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2557,6 +2928,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2591,6 +2967,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] }, "get": { @@ -2603,6 +2984,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2624,6 +3010,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] }, "patch": { @@ -2643,6 +3034,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] }, "delete": { @@ -2662,6 +3058,11 @@ }, "tags": [ "Inputs" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2676,6 +3077,14 @@ }, "tags": [ "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "get": { @@ -2688,6 +3097,14 @@ }, "tags": [ "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2709,6 +3126,14 @@ }, "tags": [ "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "put": { @@ -2737,6 +3162,14 @@ }, "tags": [ "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "delete": { @@ -2756,6 +3189,14 @@ }, "tags": [ "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2791,6 +3232,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "post": { @@ -2813,6 +3262,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2827,6 +3284,11 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -2848,6 +3310,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2871,6 +3341,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "put": { @@ -2900,6 +3378,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "delete": { @@ -2928,6 +3414,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2942,6 +3436,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2963,6 +3465,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -2984,6 +3494,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -3005,6 +3523,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "post": { @@ -3033,6 +3559,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -3056,6 +3590,11 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -3079,6 +3618,11 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -3119,6 +3663,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] }, "delete": { @@ -3157,6 +3709,14 @@ }, "tags": [ "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } ] } }, @@ -3398,6 +3958,11 @@ }, "tags": [ "Productboard" + ], + "security": [ + { + "access-token": [] + } ] } }, @@ -3409,12 +3974,17 @@ "201": { "description": "" } - } + }, + "security": [ + { + "access-token": [] + } + ] } } }, "info": { - "title": "Maestro - feat/embed-private", + "title": "Maestro - main", "description": "Documentation for Maestro gateway", "version": "1.0.0", "contact": {} @@ -3423,10 +3993,10 @@ "servers": [], "components": { "securitySchemes": { - "Authorization": { - "scheme": "bearer", - "bearerFormat": "JWT", - "type": "http" + "access-token": { + "type": "apiKey", + "name": "Authorization", + "in": "header" } }, "schemas": { diff --git a/src/authentication/authentication.decorator.ts b/src/authentication/authentication.decorator.ts index 5bebd81..2016872 100644 --- a/src/authentication/authentication.decorator.ts +++ b/src/authentication/authentication.decorator.ts @@ -1,7 +1,8 @@ import { Request } from 'express'; -import { CustomDecorator } from '@nestjs/common'; +import { applyDecorators, CustomDecorator } from '@nestjs/common'; import { PermissionsObjectPermission } from './permissions.enum'; import { RequestUser } from './user.decorator'; +import { ApiSecurity } from '@nestjs/swagger'; export const AUTH_FUNCTION_KEY = '__AUTH_FUNCTION__'; @@ -10,7 +11,7 @@ export type AuthenticationFunction = (req: Request, user: any) => boolean; // implementation copied from SetMetadata, but tweaked to get existing values // of the metadataKey and accumulate it with the new metadataValue function SetMultipleMetadata(metadataKey, metadataValue): CustomDecorator { - const decoratorFactory = (target, key, descriptor) => { + const decoratorFactory: CustomDecorator = (target, key?, descriptor?) => { // .start: tweak // descriptor?.value = function decorator; target = class decorator const accumulatedVal = @@ -28,13 +29,20 @@ function SetMultipleMetadata(metadataKey, metadataValue): CustomDecorator { }; decoratorFactory.KEY = metadataKey; - return decoratorFactory as any; + return decoratorFactory; +} + +function createAuthenticatedDecorator(metadataValue: AuthenticationFunction) { + return applyDecorators( + ApiSecurity('access-token'), + SetMultipleMetadata(AUTH_FUNCTION_KEY, metadataValue), + ); } export function RequireAllPermissions( ...permissions: PermissionsObjectPermission[] ) { - return SetMultipleMetadata(AUTH_FUNCTION_KEY, (req, user: RequestUser) => + return createAuthenticatedDecorator((req, user: RequestUser) => permissions.every(({ seqid }) => user.permissions.includes(seqid)), ); } @@ -42,15 +50,15 @@ export function RequireAllPermissions( export function RequireSomePermission( ...permissions: PermissionsObjectPermission[] ) { - return SetMultipleMetadata(AUTH_FUNCTION_KEY, (req, user: RequestUser) => + return createAuthenticatedDecorator((req, user: RequestUser) => permissions.some(({ seqid }) => user.permissions.includes(seqid)), ); } export function AuthenticateCondition(func: AuthenticationFunction) { - return SetMultipleMetadata(AUTH_FUNCTION_KEY, func); + return createAuthenticatedDecorator(func); } export function Authenticated() { - return SetMultipleMetadata(AUTH_FUNCTION_KEY, () => true); + return createAuthenticatedDecorator(() => true); } diff --git a/src/authentication/authentication.guard.ts b/src/authentication/authentication.guard.ts index 44b3a75..07125b1 100644 --- a/src/authentication/authentication.guard.ts +++ b/src/authentication/authentication.guard.ts @@ -54,14 +54,11 @@ export class AuthenticationGuard >(AUTH_FUNCTION_KEY, [ctx.getClass(), ctx.getHandler()]); const mustBeAuthenticated = authFunctions.length > 0; + if (!mustBeAuthenticated) return true; + const request = ctx.switchToHttp().getRequest(); const accessToken = this.validateToken(request, mustBeAuthenticated); - if (!mustBeAuthenticated) { - // no need to be authenticated - return true; - } - if (!accessToken) { // couldn't load valid token throw new ErrorBuilder(ErrorCodes.AUTH.UNAUTHORIZED); diff --git a/src/main.ts b/src/main.ts index 7235e3b..c3bf5da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,10 +46,11 @@ function configureSwagger(app: INestApplication) { const config = new DocumentBuilder() .setTitle(swaggerTitle) .setDescription('Documentation for Maestro gateway') - .addBearerAuth( - { type: 'http', scheme: 'bearer', bearerFormat: 'JWT' }, - 'Authorization', - ) + .addSecurity('access-token', { + type: 'apiKey', + name: 'Authorization', + in: 'header', + }) .build(); const document = SwaggerModule.createDocument(app, config); diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 2bf3915..9739012 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -9,7 +9,7 @@ import { UseFilters, Get, } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiSecurity, ApiTags } from '@nestjs/swagger'; import { AuthChangePasswordRequest, AuthResetPasswordRequest, @@ -203,6 +203,7 @@ export class AuthController { } @Authenticated() + @ApiSecurity('access-token') @Get('verify-access-token') @HttpCode(HttpStatus.OK) verifyAccessToken() { diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 71f69f3..3a29107 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -6,7 +6,6 @@ import { ForbiddenException, Get, Headers, - HttpException, Inject, NotFoundException, Param, diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index 2aa47cf..67d5c3e 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 { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; +import { ApiTags } from '@nestjs/swagger'; import { ConnectionClientService } from './client.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { @@ -34,7 +34,6 @@ import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filt const connectionPermissions = PERMISSIONS_GROUPS.CONNECTION.permissions; @UseFilters(new GrpcToHttpExceptionFilter()) @ApiTags('connections') -@ApiBearerAuth() @Authenticated() @Controller('connections') export class ConnectionController { diff --git a/src/modules/connector/connector.controller.ts b/src/modules/connector/connector.controller.ts index c95ff54..ba2116f 100644 --- a/src/modules/connector/connector.controller.ts +++ b/src/modules/connector/connector.controller.ts @@ -15,7 +15,7 @@ import { UploadedFiles, } from '@nestjs/common'; import { FileInterceptor, FilesInterceptor } from '@nestjs/platform-express'; -import { ApiBearerAuth, ApiConsumes, ApiTags } from '@nestjs/swagger'; +import { ApiConsumes, ApiTags } from '@nestjs/swagger'; import { ConnectorClientService } from './client.service'; import { AddTagDto } from './dtos/add-tag'; import { CreateConnectorDto } from './dtos/create-connector'; @@ -31,7 +31,6 @@ import { import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; @ApiTags('connectors') -@ApiBearerAuth() @Authenticated() @Controller('connectors') export class ConnectorController { diff --git a/src/modules/productboard/productboard.controller.ts b/src/modules/productboard/productboard.controller.ts index 55327df..16e47c3 100644 --- a/src/modules/productboard/productboard.controller.ts +++ b/src/modules/productboard/productboard.controller.ts @@ -1,12 +1,14 @@ import { Body, Controller, HttpException, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import axios from 'axios'; +import { Authenticated } from 'src/authentication/authentication.decorator'; import { User, RequestUser } from 'src/authentication/user.decorator'; import { getSecretFromSecretsManager } from 'src/utils/SecretManager'; import { INote } from './dtos'; @ApiTags('Productboard') @Controller('productboard') +@Authenticated() export class ProductboardController { @Post('notes') async sendNote(@Body() note: INote, @User() user: RequestUser) { From 9fcbeda4705c5dfdd433a4add5f558004d485738 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 8 Feb 2023 18:07:06 -0300 Subject: [PATCH 02/19] FIX: deprecating old pipeline routes --- docsfera.json | 136 +++++++++++++----- src/modules/catalog/catalog.controller.ts | 5 +- src/modules/catalog/dtos/index.ts | 9 +- .../connection/connection.controller.ts | 3 +- src/modules/pipelines/pipelines.controller.ts | 12 +- .../pipelinesV2/pipelines.controller.ts | 58 ++++++-- 6 files changed, 171 insertions(+), 52 deletions(-) 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; + } } From fbc0d2eede649d6afb688af59d915a0bb628bc38 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Fri, 10 Feb 2023 14:23:27 -0300 Subject: [PATCH 03/19] FIX: moved decorators to a separate folder --- .../authentication.guard.spec.ts | 2 +- src/authentication/authentication.guard.ts | 4 +- .../authentication.decorator.ts | 47 +++++-------------- src/decorators/shared.ts | 28 +++++++++++ .../user.decorator.spec.ts | 17 +++---- .../user.decorator.ts | 2 +- src/modules/auth/auth.controller.ts | 4 +- src/modules/catalog/catalog.controller.ts | 4 +- .../connection-test.controller.ts | 4 +- .../connection-test.service.ts | 2 +- .../connection/connection.controller.ts | 4 +- src/modules/connector/connector.controller.ts | 2 +- src/modules/inputs/inputs.controller.ts | 4 +- src/modules/mixpanel/mixpanel.controller.ts | 4 +- .../network-config.controller.ts | 4 +- .../permissions/permissions.controller.ts | 4 +- src/modules/pipelines/pipelines.controller.ts | 2 +- .../pipelinesV2/pipelines.controller.ts | 4 +- src/modules/pipelinesV2/pipelines.service.ts | 2 +- .../productboard/productboard.controller.ts | 4 +- src/modules/roles/roles.controller.ts | 4 +- src/modules/roles/roles.service.ts | 2 +- .../termsOfUse/termsOfUse.controller.ts | 2 +- .../transformations.controller.ts | 5 +- src/modules/users/users.controller.ts | 16 +++---- 25 files changed, 89 insertions(+), 88 deletions(-) rename src/{authentication => decorators}/authentication.decorator.ts (50%) create mode 100644 src/decorators/shared.ts rename src/{authentication => decorators}/user.decorator.spec.ts (95%) rename src/{authentication => decorators}/user.decorator.ts (89%) diff --git a/src/authentication/authentication.guard.spec.ts b/src/authentication/authentication.guard.spec.ts index 8edac59..0aa983e 100644 --- a/src/authentication/authentication.guard.spec.ts +++ b/src/authentication/authentication.guard.spec.ts @@ -11,7 +11,7 @@ import { Authenticated, RequireAllPermissions, RequireSomePermission, -} from './authentication.decorator'; +} from '../decorators/authentication.decorator'; import { AuthenticationGuard } from './authentication.guard'; import { PERMISSIONS_GROUPS } from './permissions.enum'; import { AuthClientService } from '../modules/auth/auth.service'; diff --git a/src/authentication/authentication.guard.ts b/src/authentication/authentication.guard.ts index 07125b1..f97bdfe 100644 --- a/src/authentication/authentication.guard.ts +++ b/src/authentication/authentication.guard.ts @@ -13,8 +13,8 @@ import { AuthClientService } from '../modules/auth/auth.service'; import { AuthenticationFunction, AUTH_FUNCTION_KEY, -} from './authentication.decorator'; -import { RequestUser } from './user.decorator'; +} from '../decorators/authentication.decorator'; +import { RequestUser } from '../decorators/user.decorator'; import ErrorBuilder from '../utils/ErrorBuilder'; import ErrorCodes from '../utils/errorCodes'; diff --git a/src/authentication/authentication.decorator.ts b/src/decorators/authentication.decorator.ts similarity index 50% rename from src/authentication/authentication.decorator.ts rename to src/decorators/authentication.decorator.ts index 2016872..385ced0 100644 --- a/src/authentication/authentication.decorator.ts +++ b/src/decorators/authentication.decorator.ts @@ -1,44 +1,14 @@ -import { Request } from 'express'; -import { applyDecorators, CustomDecorator } from '@nestjs/common'; -import { PermissionsObjectPermission } from './permissions.enum'; -import { RequestUser } from './user.decorator'; +import { applyDecorators } from '@nestjs/common'; import { ApiSecurity } from '@nestjs/swagger'; +import { type Request } from 'express'; +import { type PermissionsObjectPermission } from '../authentication/permissions.enum'; +import { type RequestUser } from './user.decorator'; +import { SetMultipleMetadata } from './shared'; export const AUTH_FUNCTION_KEY = '__AUTH_FUNCTION__'; export type AuthenticationFunction = (req: Request, user: any) => boolean; -// implementation copied from SetMetadata, but tweaked to get existing values -// of the metadataKey and accumulate it with the new metadataValue -function SetMultipleMetadata(metadataKey, metadataValue): CustomDecorator { - const decoratorFactory: CustomDecorator = (target, key?, descriptor?) => { - // .start: tweak - // descriptor?.value = function decorator; target = class decorator - const accumulatedVal = - Reflect.getMetadata(metadataKey, descriptor?.value ?? target) ?? []; - accumulatedVal.push(metadataValue); - // .end: tweak - - if (descriptor) { - Reflect.defineMetadata(metadataKey, accumulatedVal, descriptor.value); - return descriptor; - } - - Reflect.defineMetadata(metadataKey, accumulatedVal, target); - return target; - }; - - decoratorFactory.KEY = metadataKey; - return decoratorFactory; -} - -function createAuthenticatedDecorator(metadataValue: AuthenticationFunction) { - return applyDecorators( - ApiSecurity('access-token'), - SetMultipleMetadata(AUTH_FUNCTION_KEY, metadataValue), - ); -} - export function RequireAllPermissions( ...permissions: PermissionsObjectPermission[] ) { @@ -62,3 +32,10 @@ export function AuthenticateCondition(func: AuthenticationFunction) { export function Authenticated() { return createAuthenticatedDecorator(() => true); } + +function createAuthenticatedDecorator(metadataValue: AuthenticationFunction) { + return applyDecorators( + ApiSecurity('access-token'), + SetMultipleMetadata(AUTH_FUNCTION_KEY, metadataValue), + ); +} diff --git a/src/decorators/shared.ts b/src/decorators/shared.ts new file mode 100644 index 0000000..9d4f659 --- /dev/null +++ b/src/decorators/shared.ts @@ -0,0 +1,28 @@ +import { type CustomDecorator } from '@nestjs/common'; + +// implementation copied from SetMetadata, but tweaked to get existing values +// of the metadataKey and accumulate it with the new metadataValue +export function SetMultipleMetadata( + metadataKey, + metadataValue, +): CustomDecorator { + const decoratorFactory: CustomDecorator = (target, key?, descriptor?) => { + // .start: tweak + // descriptor?.value = function decorator; target = class decorator + const accumulatedVal = + Reflect.getMetadata(metadataKey, descriptor?.value ?? target) ?? []; + accumulatedVal.push(metadataValue); + // .end: tweak + + if (descriptor) { + Reflect.defineMetadata(metadataKey, accumulatedVal, descriptor.value); + return descriptor; + } + + Reflect.defineMetadata(metadataKey, accumulatedVal, target); + return target; + }; + + decoratorFactory.KEY = metadataKey; + return decoratorFactory; +} diff --git a/src/authentication/user.decorator.spec.ts b/src/decorators/user.decorator.spec.ts similarity index 95% rename from src/authentication/user.decorator.spec.ts rename to src/decorators/user.decorator.spec.ts index c1a041a..90488f3 100644 --- a/src/authentication/user.decorator.spec.ts +++ b/src/decorators/user.decorator.spec.ts @@ -1,17 +1,14 @@ -import request from 'supertest'; -import { Test } from '@nestjs/testing'; -import { HttpStatus, INestApplication } from '@nestjs/common'; -import { APP_GUARD } from '@nestjs/core'; -import jwt from 'jsonwebtoken'; - -import { Controller, Get } from '@nestjs/common'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; -import { AuthenticationGuard } from './authentication.guard'; +import { Controller, Get, HttpStatus, INestApplication } from '@nestjs/common'; +import { APP_GUARD } from '@nestjs/core'; +import { Test } from '@nestjs/testing'; +import jwt from 'jsonwebtoken'; +import request from 'supertest'; +import { AuthenticationGuard } from '../authentication/authentication.guard'; +import { PERMISSIONS_GROUPS } from '../authentication/permissions.enum'; import { AuthClientService } from '../modules/auth/auth.service'; - import ErrorCodes from '../utils/errorCodes'; import { User } from './user.decorator'; -import { PERMISSIONS_GROUPS } from './permissions.enum'; const logger = { info: (...args) => args, diff --git a/src/authentication/user.decorator.ts b/src/decorators/user.decorator.ts similarity index 89% rename from src/authentication/user.decorator.ts rename to src/decorators/user.decorator.ts index bdec568..94b6045 100644 --- a/src/authentication/user.decorator.ts +++ b/src/decorators/user.decorator.ts @@ -1,4 +1,4 @@ -import { createParamDecorator, ExecutionContext } from '@nestjs/common'; +import { createParamDecorator, type ExecutionContext } from '@nestjs/common'; import ErrorBuilder from '../utils/ErrorBuilder'; import ErrorCodes from '../utils/errorCodes'; diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 9739012..1fb66e7 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -24,11 +24,11 @@ import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; import { Authenticated, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { AuthClientService } from './auth.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { AuthRefreshAccessTokenReq, AuthSignInReq, diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index d9ba418..1dc4b55 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -18,12 +18,12 @@ import { ApiTags } from '@nestjs/swagger'; import { Authenticated, RequireSomePermission, -} from '../../authentication/authentication.decorator'; +} from '../../decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { CatalogService } from './catalog.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { ICatalogAllResponse, IColumnsMetadataResponse, diff --git a/src/modules/connection-test/connection-test.controller.ts b/src/modules/connection-test/connection-test.controller.ts index c3a86f8..cc5c6c8 100644 --- a/src/modules/connection-test/connection-test.controller.ts +++ b/src/modules/connection-test/connection-test.controller.ts @@ -9,7 +9,7 @@ import { ValidationPipe, } from '@nestjs/common'; import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { User, RequestUser } from 'src/authentication/user.decorator'; +import { User, RequestUser } from 'src/decorators/user.decorator'; import { ConnectionTestService } from './connection-test.service'; import { ConnectionTestPingRes, @@ -24,7 +24,7 @@ import { GetTableMetadataReq, } from './dto/connection-test'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; -import { Authenticated } from 'src/authentication/authentication.decorator'; +import { Authenticated } from 'src/decorators/authentication.decorator'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; @ApiTags('Connection Test') diff --git a/src/modules/connection-test/connection-test.service.ts b/src/modules/connection-test/connection-test.service.ts index 6e78443..310555a 100644 --- a/src/modules/connection-test/connection-test.service.ts +++ b/src/modules/connection-test/connection-test.service.ts @@ -19,7 +19,7 @@ import { CreateConnectionDto, DatabaseConnectionPropertiesDto, } from '../connection/dtos/connection'; -import { RequestUser } from 'src/authentication/user.decorator'; +import { RequestUser } from 'src/decorators/user.decorator'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; @Injectable() diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index 4ea8897..c986617 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -17,9 +17,9 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { Authenticated, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { ValidationPipe } from '../../pipes/object-validation.pipe'; import { ConnectionDetailsRes, diff --git a/src/modules/connector/connector.controller.ts b/src/modules/connector/connector.controller.ts index ba2116f..badf102 100644 --- a/src/modules/connector/connector.controller.ts +++ b/src/modules/connector/connector.controller.ts @@ -27,7 +27,7 @@ import { Authenticated, RequireAllPermissions, RequireSomePermission, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; @ApiTags('connectors') diff --git a/src/modules/inputs/inputs.controller.ts b/src/modules/inputs/inputs.controller.ts index 4ce5dc6..d7670bf 100644 --- a/src/modules/inputs/inputs.controller.ts +++ b/src/modules/inputs/inputs.controller.ts @@ -12,7 +12,7 @@ import { import { InputsService } from './inputs.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; -import { AuthenticateCondition } from 'src/authentication/authentication.decorator'; +import { AuthenticateCondition } from 'src/decorators/authentication.decorator'; import { ApiOkResponse, ApiTags } from '@nestjs/swagger'; import { CreateInputReq, @@ -21,7 +21,7 @@ import { Input, } from './dtos/input.model'; import { UpdateInputRequest } from './dtos/old_interfaces'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; diff --git a/src/modules/mixpanel/mixpanel.controller.ts b/src/modules/mixpanel/mixpanel.controller.ts index bf04196..cb1b641 100644 --- a/src/modules/mixpanel/mixpanel.controller.ts +++ b/src/modules/mixpanel/mixpanel.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Inject, Param, Post } from '@nestjs/common'; import { init } from 'mixpanel'; -import { Authenticated } from 'src/authentication/authentication.decorator'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { Authenticated } from 'src/decorators/authentication.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; @Authenticated() @Controller('trackEvent') diff --git a/src/modules/network-config/network-config.controller.ts b/src/modules/network-config/network-config.controller.ts index f65ecbb..3e1291c 100644 --- a/src/modules/network-config/network-config.controller.ts +++ b/src/modules/network-config/network-config.controller.ts @@ -15,7 +15,7 @@ import { import { NetworkConfigService } from './network-config.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { ApiConsumes, ApiOkResponse, ApiTags } from '@nestjs/swagger'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { CreateNetworkConfigReq, CreateNetworkConfigRes, @@ -26,7 +26,7 @@ import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; import { Authenticated, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; const networkConfigPermissions = PERMISSIONS_GROUPS.NETWORK_CONFIG.permissions; @ApiTags('Network Config') diff --git a/src/modules/permissions/permissions.controller.ts b/src/modules/permissions/permissions.controller.ts index 0383d9f..ad51354 100644 --- a/src/modules/permissions/permissions.controller.ts +++ b/src/modules/permissions/permissions.controller.ts @@ -1,9 +1,9 @@ import { Controller, Get, Headers, Inject } from '@nestjs/common'; import { ApiHeader, ApiOkResponse, ApiTags } from '@nestjs/swagger'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; -import { Authenticated } from 'src/authentication/authentication.decorator'; +import { Authenticated } from 'src/decorators/authentication.decorator'; import { PermissionUsages } from 'src/authentication/permissions.enum'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; import { GetPublicPermissionsRes } from './dto/entities'; import { PermissionsService } from './permissions.service'; diff --git a/src/modules/pipelines/pipelines.controller.ts b/src/modules/pipelines/pipelines.controller.ts index 3eb334b..ea094b8 100644 --- a/src/modules/pipelines/pipelines.controller.ts +++ b/src/modules/pipelines/pipelines.controller.ts @@ -3,7 +3,7 @@ import { ApiOperation, ApiTags } from '@nestjs/swagger'; import { AuthenticateCondition, Authenticated, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { PipelinesService } from './pipelines.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; diff --git a/src/modules/pipelinesV2/pipelines.controller.ts b/src/modules/pipelinesV2/pipelines.controller.ts index 521251b..ab3093e 100644 --- a/src/modules/pipelinesV2/pipelines.controller.ts +++ b/src/modules/pipelinesV2/pipelines.controller.ts @@ -25,12 +25,12 @@ import { import { AuthenticateCondition, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { PipelinesService } from './pipelines.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { Messages } from '@dadosfera/protospack-v2/dist/lib/PipelineV2'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; import { PipelinesService as OldPipelineService } from 'src/modules/pipelines/pipelines.service'; diff --git a/src/modules/pipelinesV2/pipelines.service.ts b/src/modules/pipelinesV2/pipelines.service.ts index de62496..dcf740b 100644 --- a/src/modules/pipelinesV2/pipelines.service.ts +++ b/src/modules/pipelinesV2/pipelines.service.ts @@ -21,7 +21,7 @@ import { PipelineV2CreateRequest } from '@dadosfera/protospack-v2/dist/lib/Pipel import { Metadata } from '@grpc/grpc-js'; import { ConnectorClientService } from '../connector/client.service'; import { InputsService } from '../inputs/inputs.service'; -import { RequestUser } from 'src/authentication/user.decorator'; +import { RequestUser } from 'src/decorators/user.decorator'; import { TransformationsService } from '../transformations/transformations.service'; import { getObjValueFromPath } from 'src/utils/ObjValueFromPath'; import ErrorCodes from 'src/utils/errorCodes'; diff --git a/src/modules/productboard/productboard.controller.ts b/src/modules/productboard/productboard.controller.ts index 16e47c3..481b6f1 100644 --- a/src/modules/productboard/productboard.controller.ts +++ b/src/modules/productboard/productboard.controller.ts @@ -1,8 +1,8 @@ import { Body, Controller, HttpException, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import axios from 'axios'; -import { Authenticated } from 'src/authentication/authentication.decorator'; -import { User, RequestUser } from 'src/authentication/user.decorator'; +import { Authenticated } from 'src/decorators/authentication.decorator'; +import { User, RequestUser } from 'src/decorators/user.decorator'; import { getSecretFromSecretsManager } from 'src/utils/SecretManager'; import { INote } from './dtos'; diff --git a/src/modules/roles/roles.controller.ts b/src/modules/roles/roles.controller.ts index ca5ab99..038245c 100644 --- a/src/modules/roles/roles.controller.ts +++ b/src/modules/roles/roles.controller.ts @@ -18,7 +18,7 @@ import { ApiOkResponse, ApiTags, } from '@nestjs/swagger'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { RolesService } from './roles.service'; import { @@ -43,7 +43,7 @@ import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; import { Authenticated, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; @ApiTags('Roles') diff --git a/src/modules/roles/roles.service.ts b/src/modules/roles/roles.service.ts index da12c7b..bd41ca5 100644 --- a/src/modules/roles/roles.service.ts +++ b/src/modules/roles/roles.service.ts @@ -18,7 +18,7 @@ import { Permission } from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/ent import { lastValueFrom } from 'rxjs'; import { PermissionsService } from '../permissions/permissions.service'; import { LanguageEnum } from 'src/utils/languages.enum'; -import { RequestUser } from 'src/authentication/user.decorator'; +import { RequestUser } from 'src/decorators/user.decorator'; import { DucClient } from '../duc/client.config'; interface GetRolesPermissionsName { diff --git a/src/modules/termsOfUse/termsOfUse.controller.ts b/src/modules/termsOfUse/termsOfUse.controller.ts index e003367..55279ff 100644 --- a/src/modules/termsOfUse/termsOfUse.controller.ts +++ b/src/modules/termsOfUse/termsOfUse.controller.ts @@ -16,7 +16,7 @@ import { TermsOfUseClientService } from './termsOfUse.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter'; -import { RequestUser, User } from '../../authentication/user.decorator'; +import { RequestUser, User } from '../../decorators/user.decorator'; import { Metadata } from '@grpc/grpc-js'; @ApiTags('TermsOfUse') diff --git a/src/modules/transformations/transformations.controller.ts b/src/modules/transformations/transformations.controller.ts index 6c8def6..df66c44 100644 --- a/src/modules/transformations/transformations.controller.ts +++ b/src/modules/transformations/transformations.controller.ts @@ -12,14 +12,13 @@ import { ApiTags } from '@nestjs/swagger'; import { TransformationsClientService } from './client.service'; import { IIdRequest } from './interfaces'; import { - AuthenticateCondition, Authenticated, RequireSomePermission, -} from 'src/authentication/authentication.decorator'; +} from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { TransformationsService } from './transformations.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; const pipelinePermissions = PERMISSIONS_GROUPS.PIPELINE.permissions; @ApiTags('Transformations') @Controller('transformations') diff --git a/src/modules/users/users.controller.ts b/src/modules/users/users.controller.ts index 8a0c17e..c05fb27 100644 --- a/src/modules/users/users.controller.ts +++ b/src/modules/users/users.controller.ts @@ -1,3 +1,4 @@ +import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { Body, Controller, @@ -20,14 +21,16 @@ import { ApiOkResponse, ApiTags, } from '@nestjs/swagger'; -import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; +import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; import { Authenticated, RequireAllPermissions, -} from 'src/authentication/authentication.decorator'; -import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; -import { RequestUser, User } from 'src/authentication/user.decorator'; +} from 'src/decorators/authentication.decorator'; +import { RequestUser, User } from 'src/decorators/user.decorator'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; +import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; +import ErrorBuilder from 'src/utils/ErrorBuilder'; +import ErrorCodes from 'src/utils/errorCodes'; import { LanguageEnum } from 'src/utils/languages.enum'; import { AssignRoleToUserReq, @@ -40,17 +43,14 @@ import { GetAllHierarchiesRes, GetAllJobTitlesRes, GetAllUsersByCustomerIdRes, + IUserByCustomer, SetUserRolesReq, SetUserRolesRes, UnassignRoleToUserReq, UpdateUserReq, UpdateUserRes, - IUserByCustomer, } from './dtos/entities'; import { UsersService } from './users.service'; -import ErrorBuilder from 'src/utils/ErrorBuilder'; -import ErrorCodes from 'src/utils/errorCodes'; -import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; @ApiTags('Users') @Controller('users') From de065122490eee90d4bc929a2c69f722bf167183 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 08:56:23 -0300 Subject: [PATCH 04/19] FIX: changed language strategy to use new custom decorator --- docsfera.json | 647 ++++++++++++++++-- src/decorators/language.decorator.ts | 25 + src/main.ts | 3 +- src/modules/auth/auth.controller.ts | 17 +- src/modules/auth/dtos/login.ts | 5 +- src/modules/catalog/catalog.controller.ts | 13 +- .../connection/connection.controller.ts | 12 +- src/modules/connector/connector.controller.ts | 13 +- .../network-config.controller.ts | 12 +- src/modules/oauth/oauth.controller.ts | 1 - .../passport-strategies/google-strategy.ts | 1 - .../permissions/permissions.controller.ts | 7 +- .../pipelinesV2/pipelines.controller.ts | 43 +- src/modules/roles/roles.controller.ts | 29 +- .../termsOfUse/termsOfUse.controller.ts | 7 +- src/modules/users/users.controller.ts | 37 +- 16 files changed, 717 insertions(+), 155 deletions(-) create mode 100644 src/decorators/language.decorator.ts diff --git a/docsfera.json b/docsfera.json index ac32457..e067c21 100644 --- a/docsfera.json +++ b/docsfera.json @@ -10,10 +10,14 @@ "operationId": "AuthController_signIn", "parameters": [ { - "name": "Dadosfera-Lang", - "required": true, + "name": "dadosfera-lang", "in": "header", + "required": false, "schema": { + "enum": [ + "pt-br", + "en-us" + ], "type": "string" } } @@ -48,7 +52,20 @@ "/auth/sso/snowflake": { "post": { "operationId": "AuthController_snowflakeSignIn", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -76,10 +93,14 @@ "operationId": "AuthController_refreshAccessToken", "parameters": [ { - "name": "Dadosfera-Lang", - "required": true, + "name": "dadosfera-lang", "in": "header", + "required": false, "schema": { + "enum": [ + "pt-br", + "en-us" + ], "type": "string" } } @@ -114,7 +135,20 @@ "/auth/change-password": { "post": { "operationId": "AuthController_changePassword", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -135,7 +169,20 @@ "/auth/reset-password": { "post": { "operationId": "AuthController_resetPassword", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -156,7 +203,20 @@ "/auth/verify-reset-password-code": { "post": { "operationId": "AuthController_verifyResetPasswordCode", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -177,7 +237,20 @@ "/auth/confirm-reset-password": { "post": { "operationId": "AuthController_confirmResetPassword", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -198,7 +271,20 @@ "/auth/enable-totp": { "post": { "operationId": "AuthController_enableTotpMFA", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -219,7 +305,20 @@ "/auth/disable-totp": { "post": { "operationId": "AuthController_disableTotpMFA", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -240,7 +339,20 @@ "/auth/dismiss-totp": { "post": { "operationId": "AuthController_dismissTotpMFA", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -261,7 +373,20 @@ "/auth/verify-totp": { "post": { "operationId": "AuthController_verifyTotp", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -282,7 +407,20 @@ "/auth/verify-access-token": { "get": { "operationId": "AuthController_verifyAccessToken", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -305,6 +443,18 @@ "get": { "operationId": "AuthController_getSession", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "session", "required": true, @@ -334,7 +484,20 @@ "/auth/oauth/google": { "get": { "operationId": "AuthController_googleOauth", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -355,7 +518,20 @@ "/auth/oauth/google/callback": { "get": { "operationId": "AuthController_googleOauthCallback", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -935,14 +1111,6 @@ "put": { "operationId": "ConnectionController_updateConnection", "parameters": [ - { - "name": "Dadosfera-Lang", - "required": true, - "in": "header", - "schema": { - "type": "string" - } - }, { "name": "id", "required": true, @@ -2633,7 +2801,20 @@ "/pipelinesV2": { "post": { "operationId": "PipelinesController_create", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -2667,7 +2848,20 @@ }, "get": { "operationId": "PipelinesController_findAll", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -2687,6 +2881,18 @@ "get": { "operationId": "PipelinesController_downloadLogs", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "pipeline_run_id", "required": true, @@ -2714,7 +2920,20 @@ "/pipelinesV2/{id}/config": { "get": { "operationId": "PipelinesController_getPipelineproperties", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -2733,7 +2952,20 @@ "/pipelinesV2/{id}/objects": { "get": { "operationId": "PipelinesController_getPipelineObjects", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -2752,7 +2984,20 @@ "/pipelinesV2/{id}/status": { "get": { "operationId": "PipelinesController_getPipelineStatus", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -2778,7 +3023,20 @@ "/pipelinesV2/{id}": { "get": { "operationId": "PipelinesController_findOne", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -2802,7 +3060,20 @@ }, "patch": { "operationId": "PipelinesController_update", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -2829,7 +3100,20 @@ "summary": "", "deprecated": true, "description": "This method is deprecated. Please use PATCH instead", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -2853,7 +3137,20 @@ }, "delete": { "operationId": "PipelinesController_delete", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "204": { "description": "" @@ -2872,7 +3169,20 @@ "/pipelinesV2/init-upload": { "post": { "operationId": "PipelinesController_initUploadFile", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -2904,7 +3214,20 @@ "/pipelinesV2/complete-upload": { "post": { "operationId": "PipelinesController_completeUploadFile", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -2943,7 +3266,20 @@ "/pipelinesV2/file": { "post": { "operationId": "PipelinesController_uploadedFile", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -2982,7 +3318,20 @@ "/pipelinesV2/start/{id}": { "post": { "operationId": "PipelinesController_activate", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "201": { "description": "", @@ -3321,7 +3670,20 @@ "/catalog": { "get": { "operationId": "CatalogController_searchCatalog", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -3348,7 +3710,20 @@ }, "post": { "operationId": "CatalogController_createDataAsset", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -3380,7 +3755,20 @@ "/catalog/data-asset": { "get": { "operationId": "CatalogController_findByPipelineAndObject", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -3399,7 +3787,20 @@ "/catalog/tags": { "get": { "operationId": "CatalogController_findAllTags", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -3429,6 +3830,18 @@ "get": { "operationId": "CatalogController_getDataAsset", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "shared", "required": true, @@ -3457,7 +3870,20 @@ }, "put": { "operationId": "CatalogController_updateDataAsset", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { @@ -3495,6 +3921,18 @@ "delete": { "operationId": "CatalogController_deleteDataAsset", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -3532,7 +3970,20 @@ "/catalog/data-asset/rls/{id}": { "get": { "operationId": "CatalogController_getDataAssetRls", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "" @@ -3554,7 +4005,20 @@ "/catalog/data-asset/{id}/columns-metadata": { "get": { "operationId": "CatalogController_getDataAssetColumnsMetadata", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -3583,7 +4047,20 @@ "/catalog/data-asset/{id}/preview": { "get": { "operationId": "CatalogController_getDataAssetPreview", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -3612,7 +4089,20 @@ "/catalog/data-asset/{id}/docs": { "get": { "operationId": "CatalogController_getDataAssetDocs", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -3640,6 +4130,18 @@ "post": { "operationId": "CatalogController_manageDataAssetDocs", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -3678,6 +4180,18 @@ "put": { "operationId": "CatalogController_manageDataAssetPermissions", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -3706,6 +4220,18 @@ "put": { "operationId": "CatalogController_revokeDataAssetPermissions", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -3734,6 +4260,18 @@ "post": { "operationId": "CatalogController_commentOnDataAsset", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -3780,6 +4318,18 @@ "delete": { "operationId": "CatalogController_deleteComment", "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, { "name": "id", "required": true, @@ -4089,7 +4639,7 @@ }, "info": { "title": "Maestro - feat/docs-refactor", - "description": "Documentation for Maestro gateway", + "description": "This is the Maestro API", "version": "1.0.0", "contact": {} }, @@ -4114,7 +4664,8 @@ "type": "string" }, "totp": { - "type": "string" + "type": "string", + "description": "TOTP code used to login when Multi-Factor Authentication is enabled" } }, "required": [ diff --git a/src/decorators/language.decorator.ts b/src/decorators/language.decorator.ts new file mode 100644 index 0000000..f455200 --- /dev/null +++ b/src/decorators/language.decorator.ts @@ -0,0 +1,25 @@ +import { createParamDecorator, type ExecutionContext } from '@nestjs/common'; +import { LanguageEnum } from 'src/utils/languages.enum'; + +export const Language: () => ParameterDecorator = createParamDecorator( + (options: any, ctx: ExecutionContext): LanguageEnum => { + const headers = ctx.switchToHttp()?.getRequest()?.headers; + + if (!headers) return LanguageEnum.ptbr; + + let language: LanguageEnum = + headers['dadosfera-lang'] ?? headers['accept-language']; + language = language?.toLowerCase().trim() as LanguageEnum; + + if (!language) return LanguageEnum.ptbr; + + Object.values(LanguageEnum).some((l) => { + if (language === l || l.includes(language)) { + language = l; + return true; + } + language = LanguageEnum.enus; + }); + return language; + }, +); diff --git a/src/main.ts b/src/main.ts index c3bf5da..1fe7ee5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -39,7 +39,7 @@ function configureSwagger(app: INestApplication) { .replace('\n', '') .trim(); } catch (error) { - console.log("Can't get branch name", error); + console.warn("Can't get branch name", error); } const swaggerTitle = branchName ? `Maestro - ${branchName}` : 'Maestro'; @@ -51,6 +51,7 @@ function configureSwagger(app: INestApplication) { name: 'Authorization', in: 'header', }) + .setDescription('This is the Maestro API') .build(); const document = SwaggerModule.createDocument(app, config); diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 01868c1..2932216 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -13,7 +13,7 @@ import { Req, Param, } from '@nestjs/common'; -import { ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { ApiHeaders, ApiSecurity, ApiTags } from '@nestjs/swagger'; import { AuthChangePasswordRequest, AuthResetPasswordRequest, @@ -43,8 +43,11 @@ import { AuthGuard } from '@nestjs/passport'; import { Request } from 'express'; import ErrorCodes, { OauthErrors } from 'src/utils/errorCodes'; import jwt from 'jsonwebtoken'; +import { LanguageEnum } from 'src/utils/languages.enum'; +import { Language } from 'src/decorators/language.decorator'; @ApiTags('Auth') +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @UseFilters(new GrpcToHttpExceptionFilter()) @Controller('auth') export class AuthController { @@ -74,10 +77,10 @@ export class AuthController { @HttpCode(HttpStatus.OK) async signIn( @Body() { username, password, totp }: AuthSignInReq, - @Headers('Dadosfera-Lang') language: string, + @Language() language: LanguageEnum, ): Promise { this.logger.info('/auth - SignIn'); - const metadata = PackTheMetadata({ language: language || 'pt-br' }); + const metadata = PackTheMetadata({ language }); return this.authClient.signIn({ username, password, totp }, metadata); } @@ -99,11 +102,11 @@ export class AuthController { @Post('refresh-access-token') @HttpCode(HttpStatus.OK) async refreshAccessToken( - @Body() - { refreshToken, customerName: customer_name }: AuthRefreshAccessTokenReq, - @Headers('Dadosfera-Lang') language: string, + @Body() body: AuthRefreshAccessTokenReq, + @Language() language: LanguageEnum, ) { this.logger.info('/auth - RefreshAccessToken'); + const { refreshToken, customerName: customer_name } = body; const metadata = PackTheMetadata({ customer_name, @@ -135,7 +138,7 @@ export class AuthController { @HttpCode(HttpStatus.OK) async resetPassword( @Body() body: AuthResetPasswordRequest, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('/auth - reset-password'); const metadata = PackTheMetadata({ diff --git a/src/modules/auth/dtos/login.ts b/src/modules/auth/dtos/login.ts index a41d8f3..981ac6c 100644 --- a/src/modules/auth/dtos/login.ts +++ b/src/modules/auth/dtos/login.ts @@ -81,7 +81,10 @@ export class AuthSignInReq implements AuthSignInRequest { username: string; @ApiProperty() password: string; - @ApiPropertyOptional() + @ApiPropertyOptional({ + description: + 'TOTP code used to login when Multi-Factor Authentication is enabled', + }) totp: string; } diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 1dc4b55..e7a2657 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -14,7 +14,7 @@ import { Query, UseFilters, } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiHeaders, ApiTags } from '@nestjs/swagger'; import { Authenticated, RequireSomePermission, @@ -36,8 +36,11 @@ import { IUpdateDataRequest, } from './dtos'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; +import { Language } from 'src/decorators/language.decorator'; +import { LanguageEnum } from 'src/utils/languages.enum'; @ApiTags('Catalog') +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @Controller('catalog') @UseFilters(new GrpcToHttpExceptionFilter()) @Authenticated() @@ -283,7 +286,7 @@ export class CatalogController { ) async getDataAssetColumnsMetadata( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Param('id') id, ): Promise { const { customer_name, customer_id, user_id, username } = user; @@ -314,7 +317,7 @@ export class CatalogController { ) async getDataAssetPreview( @User() user: RequestUser, - @Headers('Dadosfera-lang') language, + @Language() language: LanguageEnum, @Param('id') id, ): Promise { const { customer_name, customer_id, user_id, username } = user; @@ -344,7 +347,7 @@ export class CatalogController { ) async getDataAssetDocs( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Param('id') id, ): Promise { const { customer_name, customer_id, user_id, username } = user; @@ -374,7 +377,7 @@ export class CatalogController { ) async updateDataAsset( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Param('id') data_asset_id, @Body() body: IUpdateDataRequest, ): Promise { diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index c986617..a2245c1 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -7,7 +7,6 @@ import { Param, Delete, Get, - Headers, Query, UseFilters, } from '@nestjs/common'; @@ -30,6 +29,8 @@ import { import { CreateConnectionDto } from './dtos/connection'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; +import { Language } from 'src/decorators/language.decorator'; +import { LanguageEnum } from 'src/utils/languages.enum'; const connectionPermissions = PERMISSIONS_GROUPS.CONNECTION.permissions; @UseFilters(new GrpcToHttpExceptionFilter()) @@ -83,12 +84,11 @@ export class ConnectionController { @RequireAllPermissions(connectionPermissions.CREATE) async updateConnection( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language: string, + @Language() language: LanguageEnum, @Param('id') id: string, @Body(new ValidationPipe()) body: UpdateConnectionDto, ): Promise { this.logger.info('/connections - Update Connection'); - if (!language) language = 'en-us'; const { user_id, customer_id, customer_name, username } = user; const metadata = PackTheMetadata({ @@ -135,11 +135,10 @@ export class ConnectionController { @Get() async getAllConnections( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Query() queries, ): Promise { this.logger.info('/connections - Get All Connection'); - if (!language) language = 'en-us'; const { user_id, customer_id, customer_name, username } = user; const { search, size, page, ...filters } = queries; @@ -161,13 +160,12 @@ export class ConnectionController { @Get('/:id') async getConnectionDetails( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @User() user: RequestUser, @Param('id') id, @Query() queries, ): Promise { this.logger.info('/connections - Get Connection Details'); - if (!language) language = 'en-us'; console.log(queries); diff --git a/src/modules/connector/connector.controller.ts b/src/modules/connector/connector.controller.ts index badf102..a786912 100644 --- a/src/modules/connector/connector.controller.ts +++ b/src/modules/connector/connector.controller.ts @@ -11,7 +11,6 @@ import { UploadedFile, UseInterceptors, Inject, - Headers, UploadedFiles, } from '@nestjs/common'; import { FileInterceptor, FilesInterceptor } from '@nestjs/platform-express'; @@ -29,6 +28,8 @@ import { RequireSomePermission, } from 'src/decorators/authentication.decorator'; import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; +import { Language } from 'src/decorators/language.decorator'; +import { LanguageEnum } from 'src/utils/languages.enum'; @ApiTags('connectors') @Authenticated() @@ -97,11 +98,10 @@ export class ConnectorController { PERMISSIONS_GROUPS.PIPELINE.permissions.DELETE, ) async getAllConnectors( - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, @Query() queries: GetAllDto, ) { this.logger.info('/GET - getAllConnectors Route'); - if (!language) language = 'en-us'; const { search, size, page, ...filters } = queries; @@ -142,12 +142,11 @@ export class ConnectorController { PERMISSIONS_GROUPS.PIPELINE.permissions.DELETE, ) async getConnector( - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, @Param('plugin') plugin: string, @Query('version') version: string, ) { this.logger.info('/GET/:plugin - getConnector Route'); - if (!language) language = 'en-us'; const pluginId = `${plugin}-${version}`; @@ -171,13 +170,11 @@ export class ConnectorController { PERMISSIONS_GROUPS.PIPELINE.permissions.DELETE, ) async getConnectorDetails( - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, @Param('plugin') plugin: string, @Query('version') version: string, ) { this.logger.info('/upload - Upload Connector Route'); - if (!language) language = 'en-us'; - const pluginId = `${plugin}-${version}`; const response: any = await this.connectorClientService.getConnectorDetails( diff --git a/src/modules/network-config/network-config.controller.ts b/src/modules/network-config/network-config.controller.ts index 3e1291c..26c0df7 100644 --- a/src/modules/network-config/network-config.controller.ts +++ b/src/modules/network-config/network-config.controller.ts @@ -1,12 +1,9 @@ import { Body, Controller, - Delete, Get, - Headers, Inject, Param, - Patch, Post, Query, UploadedFile, @@ -27,6 +24,8 @@ import { Authenticated, RequireAllPermissions, } from 'src/decorators/authentication.decorator'; +import { Language } from 'src/decorators/language.decorator'; +import { LanguageEnum } from 'src/utils/languages.enum'; const networkConfigPermissions = PERMISSIONS_GROUPS.NETWORK_CONFIG.permissions; @ApiTags('Network Config') @@ -44,14 +43,13 @@ export class NetworkConfigController { @ApiOkResponse({ type: FindAllNetworkConfigsRes }) async findAllNetworkConfigs( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Query() queries, ) { this.logger.info('GET /network-config', { user: user.user_id, customer: user.customer_name, }); - if (!language) language = 'en-us'; const { user_id, customer_id, customer_name } = user; const { search, size, page, ...filters } = queries; @@ -79,14 +77,14 @@ export class NetworkConfigController { @ApiOkResponse({ type: FindAllNetworkConfigsRes }) async findNetworkConfigByIdDetails( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Param('id') id: string, ) { this.logger.info('GET /network-config/:id', { user: user.user_id, customer: user.customer_name, }); - if (!language) language = 'en-us'; + return this.networkConfigService.findNetworkConfigByIdDetails(id, { customer_name: user.customer_name, customer_id: user.customer_id, diff --git a/src/modules/oauth/oauth.controller.ts b/src/modules/oauth/oauth.controller.ts index 518dd24..2feb441 100644 --- a/src/modules/oauth/oauth.controller.ts +++ b/src/modules/oauth/oauth.controller.ts @@ -15,7 +15,6 @@ export class OauthController { private logger: DadosferaLogger, ) { switch (process.env.ENV) { - case 'dev': case 'stg': this.redirectUrl = `https://app.${process.env.ENV}.dadosfera.ai/collect/auth-callback`; break; diff --git a/src/modules/oauth/passport-strategies/google-strategy.ts b/src/modules/oauth/passport-strategies/google-strategy.ts index 1bd6ffc..972ebc4 100644 --- a/src/modules/oauth/passport-strategies/google-strategy.ts +++ b/src/modules/oauth/passport-strategies/google-strategy.ts @@ -29,7 +29,6 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') { super(options, verify); switch (process.env.ENV) { - case 'dev': case 'stg': this.redirect_uri = `https://maestro.${process.env.ENV}.dadosfera.ai/oauth`; break; diff --git a/src/modules/permissions/permissions.controller.ts b/src/modules/permissions/permissions.controller.ts index ad51354..45b46d0 100644 --- a/src/modules/permissions/permissions.controller.ts +++ b/src/modules/permissions/permissions.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Headers, Inject } from '@nestjs/common'; +import { Controller, Get, Inject } from '@nestjs/common'; import { ApiHeader, ApiOkResponse, ApiTags } from '@nestjs/swagger'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { Authenticated } from 'src/decorators/authentication.decorator'; @@ -7,6 +7,7 @@ import { RequestUser, User } from 'src/decorators/user.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; import { GetPublicPermissionsRes } from './dto/entities'; import { PermissionsService } from './permissions.service'; +import { Language } from 'src/decorators/language.decorator'; @ApiTags('Permissions') @Authenticated() @@ -32,10 +33,10 @@ export class PermissionsController { @ApiOkResponse({ type: GetPublicPermissionsRes }) getPublicPermissions( @User() user: RequestUser, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('getPublicPermissions', { user }); - if (!language) language = 'en-us'; + const permissionGroups = this.permissionsService.getPermissionsGrouped( PermissionUsages.PUBLIC, language, diff --git a/src/modules/pipelinesV2/pipelines.controller.ts b/src/modules/pipelinesV2/pipelines.controller.ts index ab3093e..66d5e1e 100644 --- a/src/modules/pipelinesV2/pipelines.controller.ts +++ b/src/modules/pipelinesV2/pipelines.controller.ts @@ -7,7 +7,6 @@ import { Param, Post, Put, - Headers, Query, UseFilters, HttpCode, @@ -18,6 +17,7 @@ import { } from '@nestjs/common'; import { ApiCreatedResponse, + ApiHeaders, ApiNoContentResponse, ApiOperation, ApiTags, @@ -42,8 +42,12 @@ import { IInitUploadCSVFile, } from './interfaces'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; -@UseFilters(new GrpcToHttpExceptionFilter()) +import { LanguageEnum } from 'src/utils/languages.enum'; +import { Language } from 'src/decorators/language.decorator'; + @ApiTags('PipelinesV2') +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) +@UseFilters(new GrpcToHttpExceptionFilter()) @Controller('pipelinesV2') @AuthenticateCondition((req, user) => { let action; @@ -83,12 +87,12 @@ export class PipelinesController { @Post() @ApiCreatedResponse({ type: IPipelineV2 }) async create( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @User() user: RequestUser, @Body() createPipelineDto: ICreatePipelineV2Req, ) { this.logger.info('PipelinesController - create', { user }); - if (!language) language = 'en-us'; + const { customer_id, customer_name, username, user_id } = user; const metadata = PackTheMetadata({ customer_id, @@ -109,13 +113,11 @@ export class PipelinesController { @Get() async findAll( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Query() data, ) { this.logger.info('PipelinesController - findAll', { user }); - if (!language) language = 'en-us'; - const { customer_id, customer_name, user_id, username } = user; const metadata = PackTheMetadata({ customer_id, @@ -135,13 +137,11 @@ export class PipelinesController { @Get('/download-logs') async downloadLogs( @User() user: RequestUser, - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Query('pipeline_run_id') pipeline_run_id: string, ) { this.logger.info('PipelinesController - downloadLogs', { user }); - if (!language) language = 'en-us'; - if (!pipeline_run_id) throw new BadRequestException('Missing pipeline_run_id'); @@ -166,29 +166,23 @@ export class PipelinesController { @Get(':id/config') async getPipelineproperties( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @User() user: RequestUser, @Param('id') id, ) { this.logger.info('PipelinesController - getPipelineproperties', { user }); - const metadata = PackTheMetadata({ - ...user, - language: language || 'pt-br', - }); + const metadata = PackTheMetadata({ ...user, language: language }); return this.pipelinesClientService.findOneProperties(id, metadata); } @Get(':id/objects') async getPipelineObjects( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @User() user: RequestUser, @Param('id') id, ) { this.logger.info('PipelinesController - getPipelineObjects', { user }); - const metadata = PackTheMetadata({ - ...user, - language: language || 'pt-br', - }); + const metadata = PackTheMetadata({ ...user, language: language }); return this.pipelinesClientService.findOneObjects(id, metadata); } @@ -212,14 +206,12 @@ export class PipelinesController { @Get('/:id') async findOne( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @User() user: RequestUser, @Param('id') id, ): Promise { this.logger.info('PipelinesController - findOne', { user }); - if (!language) language = 'en-us'; - const { customer_id, customer_name, user_id, username } = user; const metadata = PackTheMetadata({ @@ -255,7 +247,7 @@ export class PipelinesController { @Patch('/:id') async update( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Body() updatePipelineDto, @Param('id') id, @User() user: RequestUser, @@ -265,7 +257,6 @@ export class PipelinesController { delete updatePipelineDto.info; const { customer_id, customer_name, user_id, username } = user; - if (!language) language = 'en-us'; const metadata = PackTheMetadata({ customer_id, @@ -294,7 +285,7 @@ export class PipelinesController { description: 'This method is deprecated. Please use PATCH instead', }) async updateDeprecated( - @Headers('Dadosfera-Lang') language, + @Language() language: LanguageEnum, @Body() updatePipelineDto, @Param('id') id, @User() user: RequestUser, diff --git a/src/modules/roles/roles.controller.ts b/src/modules/roles/roles.controller.ts index 038245c..f3fa0bb 100644 --- a/src/modules/roles/roles.controller.ts +++ b/src/modules/roles/roles.controller.ts @@ -3,7 +3,6 @@ import { Controller, Delete, Get, - Headers, Inject, Param, Patch, @@ -14,7 +13,7 @@ import { } from '@nestjs/common'; import { ApiCreatedResponse, - ApiHeader, + ApiHeaders, ApiOkResponse, ApiTags, } from '@nestjs/swagger'; @@ -45,14 +44,10 @@ import { RequireAllPermissions, } from 'src/decorators/authentication.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; +import { Language } from 'src/decorators/language.decorator'; @ApiTags('Roles') -@ApiHeader({ - name: 'dadosfera-lang', - enum: LanguageEnum, - required: false, - description: 'Defaults to pt-br', -}) +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @Authenticated() @UseFilters(new GrpcToHttpExceptionFilter()) @Controller('roles') @@ -72,7 +67,7 @@ export class RolesController { async searchRoles( @User() user: RequestUser, @Query() params: GetRolesByCustomerReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('searchRoles', { user }); this.rolesService.setLanguage(language); @@ -85,7 +80,7 @@ export class RolesController { async createRole( @User() user: RequestUser, @Body() body: CreateRoleReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('createRole', { user }); this.rolesService.setLanguage(language); @@ -98,7 +93,7 @@ export class RolesController { async grantPermissionsToRole( @User() user: RequestUser, @Body() body: GrantPermissionsToRoleReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('grantPermissionsToRole', { user }); this.rolesService.setLanguage(language); @@ -111,7 +106,7 @@ export class RolesController { async revokePermissionsFromRole( @User() user: RequestUser, @Body() body: RevokePermissionsFromRoleReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('revokePermissionsToRole', { user }); this.rolesService.setLanguage(language); @@ -124,7 +119,7 @@ export class RolesController { async setRolePermissions( @User() user: RequestUser, @Body() body: SetRolePermissionsReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('setRolePermissions', { user }); this.rolesService.setLanguage(language); @@ -137,7 +132,7 @@ export class RolesController { async setRoleUsers( @User() user: RequestUser, @Body() body: SetRoleUsersReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('setRoleUsers', { user }); this.rolesService.setLanguage(language); @@ -150,7 +145,7 @@ export class RolesController { async getRoleById( @User() user: RequestUser, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('getRoleById', { user }); this.rolesService.setLanguage(language); @@ -162,7 +157,7 @@ export class RolesController { async deleteRole( @User() user: RequestUser, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('deleteRole', { user }); this.rolesService.setLanguage(language); @@ -176,7 +171,7 @@ export class RolesController { @User() user: RequestUser, @Param('id') id: string, @Body() body: UpdateRoleReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('updateRole', { user }); this.rolesService.setLanguage(language); diff --git a/src/modules/termsOfUse/termsOfUse.controller.ts b/src/modules/termsOfUse/termsOfUse.controller.ts index 55279ff..7d23139 100644 --- a/src/modules/termsOfUse/termsOfUse.controller.ts +++ b/src/modules/termsOfUse/termsOfUse.controller.ts @@ -9,7 +9,7 @@ import { Headers, UseFilters, } from '@nestjs/common'; -import { ApiTags } from '@nestjs/swagger'; +import { ApiHeaders, ApiTags } from '@nestjs/swagger'; import { TermsOfUseAcceptRequest } from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/messages'; import { TermsOfUseClientService } from './termsOfUse.service'; @@ -18,8 +18,11 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter'; import { RequestUser, User } from '../../decorators/user.decorator'; import { Metadata } from '@grpc/grpc-js'; +import { Language } from 'src/decorators/language.decorator'; +import { LanguageEnum } from 'src/utils/languages.enum'; @ApiTags('TermsOfUse') +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @UseFilters(new GrpcToHttpExceptionFilter()) @Controller('terms-of-use') export class TermsOfUseController { @@ -36,7 +39,7 @@ export class TermsOfUseController { @Get('token') async getToken( @User({ required: true }) user: RequestUser, - @Headers('Dadosfera-Lang') language: string, + @Language() language: LanguageEnum, ) { this.logger.info('/terms-of-use - get token'); const metadata = new Metadata(); diff --git a/src/modules/users/users.controller.ts b/src/modules/users/users.controller.ts index c05fb27..308d4fd 100644 --- a/src/modules/users/users.controller.ts +++ b/src/modules/users/users.controller.ts @@ -4,7 +4,6 @@ import { Controller, Delete, Get, - Headers, HttpCode, HttpStatus, Inject, @@ -17,7 +16,7 @@ import { } from '@nestjs/common'; import { ApiCreatedResponse, - ApiHeader, + ApiHeaders, ApiOkResponse, ApiTags, } from '@nestjs/swagger'; @@ -26,6 +25,7 @@ import { Authenticated, RequireAllPermissions, } from 'src/decorators/authentication.decorator'; +import { Language } from 'src/decorators/language.decorator'; import { RequestUser, User } from 'src/decorators/user.decorator'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; @@ -54,12 +54,7 @@ import { UsersService } from './users.service'; @ApiTags('Users') @Controller('users') -@ApiHeader({ - name: 'dadosfera-lang', - enum: LanguageEnum, - required: false, - description: 'Defaults to pt-br', -}) +@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @Authenticated() @UseFilters(GrpcToHttpExceptionFilter) export class UsersController { @@ -76,7 +71,7 @@ export class UsersController { @Get() async getAllUsersByCustomerId( @User() user: RequestUser, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ): Promise { this.logger.info('getAllUsersByCustomerId', { user }); this.userService.setLanguage(language); @@ -88,7 +83,7 @@ export class UsersController { @ApiOkResponse({ type: GetAllHierarchiesRes }) async getAllHierarchies( @User() user: RequestUser, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ): Promise { this.logger.info('getAllHierarchies', { user }); this.userService.setLanguage(language); @@ -100,7 +95,7 @@ export class UsersController { @ApiOkResponse({ type: GetAllDepartmentsRes }) async getAllDepartments( @User() user: RequestUser, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ): Promise { this.logger.info('getAllHierarchies', { user }); this.userService.setLanguage(language); @@ -112,7 +107,7 @@ export class UsersController { @ApiOkResponse({ type: GetAllDepartmentsRes }) async getAllJobTitles( @User() user: RequestUser, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ): Promise { this.logger.info('getAllHierarchies', { user }); this.userService.setLanguage(language); @@ -126,7 +121,7 @@ export class UsersController { async findOneById( @User() user: RequestUser, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('findOneById', { user }); this.userService.setLanguage(language); @@ -147,7 +142,7 @@ export class UsersController { async createUser( @User() user: RequestUser, @Body() body: CreateUserReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { const metadata = PackTheMetadata({ access_token: user.access_token, @@ -165,7 +160,7 @@ export class UsersController { async batchCreateUser( @User() user: RequestUser, @Body() body: BatchCreateUserReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('batchCreateUser', { user }); this.userService.setLanguage(language); @@ -184,7 +179,7 @@ export class UsersController { async resendInvite( @User() user: RequestUser, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('resendInvite', { user }); this.userService.setLanguage(language); @@ -200,7 +195,7 @@ export class UsersController { async unassignRoleToUser( @User() user: RequestUser, @Query() request: UnassignRoleToUserReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('unassignRoleToUser', { user }); this.userService.setLanguage(language); @@ -213,7 +208,7 @@ export class UsersController { async deleteUser( @User() user: RequestUser, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('deleteUser', { user }); this.userService.setLanguage(language); @@ -226,7 +221,7 @@ export class UsersController { async setUserRoles( @User() user: RequestUser, @Body() body: SetUserRolesReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('createUser', { user }); this.userService.setLanguage(language); @@ -238,7 +233,7 @@ export class UsersController { async assignRoleToUser( @User() user: RequestUser, @Body() body: AssignRoleToUserReq, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('assignRoleToUser', { user }); this.userService.setLanguage(language); @@ -252,7 +247,7 @@ export class UsersController { @User() user: RequestUser, @Body() body: UpdateUserReq, @Param('id') id: string, - @Headers('dadosfera-lang') language, + @Language() language: LanguageEnum, ) { this.logger.info('updateUser', { user }); this.userService.setLanguage(language); From c5c089e5d50c76bde0b0fb9c5e37e0ac89c0f071 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 09:25:14 -0300 Subject: [PATCH 05/19] Better error handling and documentation on refresh token --- docsfera.json | 66 +++++++++++-------- src/modules/auth/auth.controller.ts | 9 ++- src/modules/auth/dtos/login.ts | 6 ++ .../permissions/permissions.service.ts | 2 +- src/utils/ErrorBuilder.ts | 8 +++ src/utils/errorCodes.ts | 1 + 6 files changed, 63 insertions(+), 29 deletions(-) diff --git a/docsfera.json b/docsfera.json index e067c21..a0952d7 100644 --- a/docsfera.json +++ b/docsfera.json @@ -121,7 +121,7 @@ "content": { "application/json": { "schema": { - "type": "object" + "$ref": "#/components/schemas/AuthRefreshAccessTokenRes" } } } @@ -998,10 +998,14 @@ "operationId": "TermsOfUseController_getToken", "parameters": [ { - "name": "Dadosfera-Lang", - "required": true, + "name": "dadosfera-lang", "in": "header", + "required": false, "schema": { + "enum": [ + "pt-br", + "en-us" + ], "type": "string" } } @@ -1026,7 +1030,20 @@ "/terms-of-use/accept": { "post": { "operationId": "TermsOfUseController_accept", - "parameters": [], + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], "responses": { "200": { "description": "", @@ -1222,7 +1239,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1260,7 +1276,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1313,7 +1328,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1356,7 +1370,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1399,7 +1412,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1442,7 +1454,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1488,7 +1499,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1537,7 +1547,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1598,7 +1607,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1651,7 +1659,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1702,7 +1709,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1759,7 +1765,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1812,7 +1817,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1865,7 +1869,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1926,7 +1929,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -1998,7 +2000,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2051,7 +2052,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2102,7 +2102,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2153,7 +2152,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2206,7 +2204,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2259,7 +2256,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2308,7 +2304,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -2357,7 +2352,6 @@ { "name": "dadosfera-lang", "in": "header", - "description": "Defaults to pt-br", "required": false, "schema": { "enum": [ @@ -4844,6 +4838,24 @@ "customerName" ] }, + "AuthRefreshAccessTokenRes": { + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "accessToken": { + "type": "string" + } + }, + "required": [ + "permissions", + "accessToken" + ] + }, "CreateConnectorDto": { "type": "object", "properties": { diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 2932216..4417a3e 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -13,7 +13,12 @@ import { Req, Param, } from '@nestjs/common'; -import { ApiHeaders, ApiSecurity, ApiTags } from '@nestjs/swagger'; +import { + ApiHeaders, + ApiOkResponse, + ApiSecurity, + ApiTags, +} from '@nestjs/swagger'; import { AuthChangePasswordRequest, AuthResetPasswordRequest, @@ -35,6 +40,7 @@ import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.fi import { RequestUser, User } from 'src/decorators/user.decorator'; import { AuthRefreshAccessTokenReq, + AuthRefreshAccessTokenRes, AuthSignInReq, AuthSignInRes, } from './dtos/login'; @@ -101,6 +107,7 @@ export class AuthController { @Post('refresh-access-token') @HttpCode(HttpStatus.OK) + @ApiOkResponse({ type: AuthRefreshAccessTokenRes }) async refreshAccessToken( @Body() body: AuthRefreshAccessTokenReq, @Language() language: LanguageEnum, diff --git a/src/modules/auth/dtos/login.ts b/src/modules/auth/dtos/login.ts index 981ac6c..eae2b64 100644 --- a/src/modules/auth/dtos/login.ts +++ b/src/modules/auth/dtos/login.ts @@ -109,3 +109,9 @@ export class AuthRefreshAccessTokenReq { @ApiProperty() customerName: string; } +export class AuthRefreshAccessTokenRes { + @ApiProperty() + permissions: string[]; + @ApiProperty() + accessToken: string; +} diff --git a/src/modules/permissions/permissions.service.ts b/src/modules/permissions/permissions.service.ts index f5a03a1..fefb723 100644 --- a/src/modules/permissions/permissions.service.ts +++ b/src/modules/permissions/permissions.service.ts @@ -63,7 +63,7 @@ export class PermissionsService (process.env.LOCAL_ENV === 'true' || process.env.ENV === 'local') ) { return this.logger.info( - "couldn't connect to DUC. suppresing in local env", + "couldn't connect to DUC. suppressing in local env", ); } diff --git a/src/utils/ErrorBuilder.ts b/src/utils/ErrorBuilder.ts index faf2b7c..88570e9 100644 --- a/src/utils/ErrorBuilder.ts +++ b/src/utils/ErrorBuilder.ts @@ -119,6 +119,14 @@ export function EnrichErrorCode(code: string) { code, }; + case ErrorCodes.AUTH.INVALID_REFRESH_TOKEN: + return { + statusCode: HttpStatus.UNAUTHORIZED, + error: 'Acesso expirado!', + message: 'Seu acesso expirou, favor fazer login novamente.', + code, + }; + case ErrorCodes.AUTH.FORBIDDEN: return { statusCode: HttpStatus.FORBIDDEN, diff --git a/src/utils/errorCodes.ts b/src/utils/errorCodes.ts index 871f006..3edb29f 100644 --- a/src/utils/errorCodes.ts +++ b/src/utils/errorCodes.ts @@ -1,5 +1,6 @@ export const AUTH = { UNAUTHORIZED: 'AUTH.UNAUTHORIZED', + INVALID_REFRESH_TOKEN: 'AUTH.INVALID_REFRESH_TOKEN', FORBIDDEN: 'AUTH.FORBIDDEN', WRONG_CREDENTIALS: 'AUTH.WRONG_CREDENTIALS', WRONG_PASSWORD_CONFIRMATION: 'AUTH.WRONG_PASSWORD_CONFIRMATION', From a2c9a462e47bb1afd8b0653483467c9191e2fa10 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 16:46:54 -0300 Subject: [PATCH 06/19] Run semantic release on manual deploy --- .github/workflows/deploy-manually.yml | 3 +-- docsfera.json | 23 +++++++++++++++++++++++ src/modules/catalog/catalog.controller.ts | 3 ++- src/modules/catalog/dtos/index.ts | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index 2674a93..cc2ac93 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -41,8 +41,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - if: github.event_name != 'workflow_dispatch' - name: Semantic Release + - name: Semantic Release uses: cycjimmy/semantic-release-action@v2 id: semantic with: diff --git a/docsfera.json b/docsfera.json index a0952d7..60424aa 100644 --- a/docsfera.json +++ b/docsfera.json @@ -3676,6 +3676,29 @@ ], "type": "string" } + }, + { + "name": "sort_by", + "required": false, + "in": "query", + "description": "Data Asset field to sort", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "required": false, + "in": "query", + "description": "Tipo de ordenação - asc: crescente; desc: decrescente ", + "schema": { + "default": "asc", + "enum": [ + "asc", + "desc" + ], + "type": "string" + } } ], "responses": { diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index e7a2657..2614b3c 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -25,6 +25,7 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; import { RequestUser, User } from 'src/decorators/user.decorator'; import { + ICatalogAllRequest, ICatalogAllResponse, IColumnsMetadataResponse, ICreateDataAsset, @@ -61,7 +62,7 @@ export class CatalogController { ) async searchCatalog( @User() user: RequestUser, - @Query() query, + @Query() query: ICatalogAllRequest, ): Promise { const { user_id, customer_name, customer_id, username, permissions } = user; this.logger.info(`/catalog - searchCatalog`, { diff --git a/src/modules/catalog/dtos/index.ts b/src/modules/catalog/dtos/index.ts index 945e04d..129cbd7 100644 --- a/src/modules/catalog/dtos/index.ts +++ b/src/modules/catalog/dtos/index.ts @@ -6,6 +6,10 @@ export enum DataAssetShareType { public = 'public', private = 'private', } +export enum OrderEnum { + asc = 'asc', + desc = 'desc', +} export class EmbedObject { @ApiProperty() url: string; @@ -112,6 +116,20 @@ export class IDeleteComment { comment: CommentToDelete; } +export class ICatalogAllRequest { + search; + page: string; + size: string; + @ApiPropertyOptional({ description: 'Data Asset field to sort' }) + sort_by: string; + @ApiPropertyOptional({ + enum: OrderEnum, + default: OrderEnum.asc, + description: 'Tipo de ordenação - asc: crescente; desc: decrescente ', + }) + order?: OrderEnum; +} + export class ICatalogAllResponse { @ApiProperty({ type: [IDataAsset] }) data_assets: IDataAsset[]; From 98262bcba91c2c3670c4fee998ff918edf4b0f4d Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 16:48:46 -0300 Subject: [PATCH 07/19] FIX: Run semantic release on manual deploy --- .github/workflows/deploy-manually.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index cc2ac93..7f2548a 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -48,10 +48,6 @@ jobs: semantic_version: 16 extra_plugins: | conventional-changelog-eslint - branches: | - [ - 'main' - ] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 35cc0094b36001f29d94a794ecef5633e30a84e5 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 16:51:53 -0300 Subject: [PATCH 08/19] FIX: new sematic release --- .github/workflows/deploy-manually.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index 7f2548a..d8303b3 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -42,10 +42,9 @@ jobs: uses: actions/checkout@v3 - name: Semantic Release - uses: cycjimmy/semantic-release-action@v2 + uses: cycjimmy/semantic-release-action@v3 id: semantic with: - semantic_version: 16 extra_plugins: | conventional-changelog-eslint env: From 99288fa805de9bc6acb363040f068b26712da841 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Tue, 14 Feb 2023 16:55:39 -0300 Subject: [PATCH 09/19] FIX: new sematic release version --- .github/workflows/deploy-manually.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index d8303b3..3c8b624 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -41,12 +41,17 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Semantic Release + - if: github.event_name != 'workflow_dispatch' + name: Semantic Release uses: cycjimmy/semantic-release-action@v3 id: semantic with: extra_plugins: | conventional-changelog-eslint + branches: | + [ + 'main' + ] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6a14c2b459c0eb8dec62f9ad341dc4e3c602c713 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Feb 2023 13:13:43 -0300 Subject: [PATCH 10/19] FIX: hide internal endpoints --- docsfera.external.json | 3227 +++++++++++ docsfera.json | 5083 ++--------------- environment.d.ts | 18 + src/app.module.ts | 14 +- src/decorators/swagger.decorator.ts | 13 + src/main.ts | 20 +- src/modules/auth/auth.controller.ts | 44 +- src/modules/catalog/catalog.controller.ts | 6 + .../connection/connection.controller.ts | 2 + src/modules/connector/connector.controller.ts | 2 + src/modules/inputs/inputs.controller.ts | 5 + src/modules/mixpanel/mixpanel.controller.ts | 2 + .../network-config-client.config.ts | 5 +- .../network-config.controller.ts | 1 + src/modules/oauth/oauth.controller.ts | 7 + .../permissions/permissions.controller.ts | 2 + .../permissions/permissions.service.ts | 2 +- src/modules/pipelines/pipelines.controller.ts | 2 + .../pipelinesV2/pipelines.controller.ts | 10 +- .../productboard/productboard.controller.ts | 2 + src/modules/roles/roles.controller.ts | 2 + .../termsOfUse/termsOfUse.controller.ts | 2 + .../transformations.controller.ts | 3 + src/modules/users/users.controller.ts | 2 + 24 files changed, 3864 insertions(+), 4612 deletions(-) create mode 100644 docsfera.external.json create mode 100644 environment.d.ts create mode 100644 src/decorators/swagger.decorator.ts diff --git a/docsfera.external.json b/docsfera.external.json new file mode 100644 index 0000000..1fdca24 --- /dev/null +++ b/docsfera.external.json @@ -0,0 +1,3227 @@ +{ + "service": "${DOCS_API_TOKEN}", + "pageId": "${DOCS_PAGE_ID}", + "blockId": "${DOCS_BLOCK_ID}", + "schema": { + "openapi": "3.0.0", + "paths": { + "/auth/sign-in": { + "post": { + "operationId": "AuthController_signIn", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthSignInReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthSignInRes" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/refresh-access-token": { + "post": { + "operationId": "AuthController_refreshAccessToken", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthRefreshAccessTokenReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthRefreshAccessTokenRes" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/connections": { + "post": { + "operationId": "ConnectionController_createConnection", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateConnectionDto" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionRes" + } + } + } + } + }, + "tags": [ + "connections" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "get": { + "operationId": "ConnectionController_getAllConnections", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionsRes" + } + } + } + } + }, + "tags": [ + "connections" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connections/{id}": { + "put": { + "operationId": "ConnectionController_updateConnection", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateConnectionDto" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionRes" + } + } + } + } + }, + "tags": [ + "connections" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "ConnectionController_deleteConnection", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionRes" + } + } + } + } + }, + "tags": [ + "connections" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "get": { + "operationId": "ConnectionController_getConnectionDetails", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionDetailsRes" + } + } + } + } + }, + "tags": [ + "connections" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/network-config": { + "get": { + "operationId": "NetworkConfigController_findAllNetworkConfigs", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FindAllNetworkConfigsRes" + } + } + } + } + }, + "tags": [ + "Network Config" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "post": { + "operationId": "NetworkConfigController_createNetworkConfigs", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateNetworkConfigReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateNetworkConfigRes" + } + } + } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateNetworkConfigRes" + } + } + } + } + }, + "tags": [ + "Network Config" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/network-config/{id}": { + "get": { + "operationId": "NetworkConfigController_findNetworkConfigById", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FindAllNetworkConfigsRes" + } + } + } + } + }, + "tags": [ + "Network Config" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/network-config/{id}/details": { + "get": { + "operationId": "NetworkConfigController_findNetworkConfigByIdDetails", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FindAllNetworkConfigsRes" + } + } + } + } + }, + "tags": [ + "Network Config" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/inputs": { + "post": { + "operationId": "InputsController_create", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateInputReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Input" + } + } + } + }, + "201": { + "description": "" + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/inputs/{id}": { + "get": { + "operationId": "InputsController_findOne", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2": { + "post": { + "operationId": "PipelinesController_create", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ICreatePipelineV2Req" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IPipelineV2" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "get": { + "operationId": "PipelinesController_findAll", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/download-logs": { + "get": { + "operationId": "PipelinesController_downloadLogs", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "pipeline_run_id", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/{id}/config": { + "get": { + "operationId": "PipelinesController_getPipelineproperties", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/{id}/objects": { + "get": { + "operationId": "PipelinesController_getPipelineObjects", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/{id}/status": { + "get": { + "operationId": "PipelinesController_getPipelineStatus", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/{id}": { + "get": { + "operationId": "PipelinesController_findOne", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "patch": { + "operationId": "PipelinesController_update", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "PipelinesController_delete", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/catalog": { + "get": { + "operationId": "CatalogController_searchCatalog", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "sort_by", + "required": false, + "in": "query", + "description": "Data Asset field to sort", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "required": false, + "in": "query", + "description": "Tipo de ordenação - asc: crescente; desc: decrescente ", + "schema": { + "default": "asc", + "enum": [ + "asc", + "desc" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ICatalogAllResponse" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "post": { + "operationId": "CatalogController_createDataAsset", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ICreateDataAsset" + } + } + } + }, + "responses": { + "201": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}": { + "get": { + "operationId": "CatalogController_getDataAsset", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "shared", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "put": { + "operationId": "CatalogController_updateDataAsset", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IUpdateDataRequest" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IOneDataAsset" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "CatalogController_deleteDataAsset", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}/columns-metadata": { + "get": { + "operationId": "CatalogController_getDataAssetColumnsMetadata", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IColumnsMetadataResponse" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}/preview": { + "get": { + "operationId": "CatalogController_getDataAssetPreview", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IPreviewResponse" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}/docs": { + "get": { + "operationId": "CatalogController_getDataAssetDocs", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IDocsResponse" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "post": { + "operationId": "CatalogController_manageDataAssetDocs", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}/comment": { + "post": { + "operationId": "CatalogController_commentOnDataAsset", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IMakeAComment" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "CatalogController_deleteComment", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IDeleteComment" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connection-test/ping": { + "post": { + "operationId": "ConnectionTestController_connectionTestPing", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestPingReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestPingRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/credentials": { + "post": { + "operationId": "ConnectionTestController_connectionTestCredentials", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestCredentialsReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestCredentialsRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/schemas": { + "post": { + "operationId": "ConnectionTestController_connectionTestListSchemas", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListSchemasReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListSchemasRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/tables": { + "post": { + "operationId": "ConnectionTestController_connectionTestListTables", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListTablesReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListTablesRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/table-metadata": { + "post": { + "operationId": "ConnectionTestController_getTableMetadata", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTableMetadataReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTableMetadataRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/oauth/hubspot": { + "get": { + "operationId": "OauthController_oauthHubspot", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/oauth/googleads": { + "get": { + "operationId": "OauthController_oauthGoogleAds", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/oauth/google-sheets": { + "get": { + "operationId": "OauthController_oauthGoogleSheets", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/oauth/facebook": { + "get": { + "operationId": "OauthController_oauthFacebook", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/oauth/mailchimp": { + "get": { + "operationId": "OauthController_oauthMailchimp", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/oauth/salesforce": { + "get": { + "operationId": "OauthController_oauthSalesforce", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "oauth" + ] + } + }, + "/health": { + "get": { + "operationId": "HealthController_check", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Health" + ] + } + } + }, + "info": { + "title": "Maestro - feat/docs-refactor", + "description": "This is the Maestro API", + "version": "1.0.0", + "contact": {} + }, + "tags": [], + "servers": [], + "components": { + "securitySchemes": { + "access-token": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + }, + "schemas": { + "AuthSignInReq": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "totp": { + "type": "string", + "description": "TOTP code used to login when Multi-Factor Authentication is enabled" + } + }, + "required": [ + "username", + "password" + ] + }, + "AuthCustomer": { + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tier": { + "type": "string" + }, + "scheduleLimit": { + "type": "string" + } + }, + "required": [ + "modules", + "id", + "name", + "tier", + "scheduleLimit" + ] + }, + "AuthUser": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "username": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "username", + "createdAt" + ] + }, + "AuthTokens": { + "type": "object", + "properties": { + "accessToken": { + "type": "string" + }, + "refreshToken": { + "type": "string" + }, + "termsOfUseToken": { + "type": "string" + }, + "idToken": { + "type": "string", + "deprecated": true + } + }, + "required": [ + "accessToken", + "refreshToken", + "idToken" + ] + }, + "TermsOfUse": { + "type": "object", + "properties": { + "version": { + "type": "number" + }, + "publicUrl": { + "type": "string" + }, + "enforceDate": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + }, + "required": [ + "version", + "publicUrl", + "enforceDate", + "createdAt" + ] + }, + "TermsOfUseStatus": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "pending", + "required", + "ok" + ] + }, + "lastSigned": { + "$ref": "#/components/schemas/TermsOfUse" + }, + "next": { + "$ref": "#/components/schemas/TermsOfUse" + } + }, + "required": [ + "status" + ] + }, + "AuthSignInRes": { + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "mfaStatus": { + "type": "string", + "enum": [ + "pending", + "none", + "totp" + ] + }, + "customer": { + "$ref": "#/components/schemas/AuthCustomer" + }, + "user": { + "$ref": "#/components/schemas/AuthUser" + }, + "tokens": { + "$ref": "#/components/schemas/AuthTokens" + }, + "termsOfUse": { + "$ref": "#/components/schemas/TermsOfUseStatus" + } + }, + "required": [ + "permissions", + "mfaStatus" + ] + }, + "AuthRefreshAccessTokenReq": { + "type": "object", + "properties": { + "refreshToken": { + "type": "string" + }, + "customerName": { + "type": "string" + } + }, + "required": [ + "refreshToken", + "customerName" + ] + }, + "AuthRefreshAccessTokenRes": { + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "accessToken": { + "type": "string" + } + }, + "required": [ + "permissions", + "accessToken" + ] + }, + "CreateConnectionDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "properties": { + "type": "object" + }, + "connector_id": { + "type": "string" + }, + "connector_name": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image_url": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "type", + "properties", + "connector_id", + "connector_name", + "plugin", + "image_url" + ] + }, + "ConnectionToCatalogDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "connector_id": { + "type": "string" + }, + "connector_name": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image_url": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "type", + "connector_id", + "connector_name", + "plugin", + "image_url" + ] + }, + "ConnectionRes": { + "type": "object", + "properties": { + "connection": { + "$ref": "#/components/schemas/ConnectionToCatalogDto" + }, + "message": { + "type": "string" + } + }, + "required": [ + "connection", + "message" + ] + }, + "UpdateConnectionDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "properties": { + "type": "object" + } + }, + "required": [ + "name", + "description", + "properties" + ] + }, + "ConnectionsRes": { + "type": "object", + "properties": { + "connections": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ConnectionToCatalogDto" + } + }, + "message": { + "type": "string" + } + }, + "required": [ + "connections", + "message" + ] + }, + "ConnectionDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "customer_name": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "pipelines": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "properties": { + "type": "object" + }, + "connector_id": { + "type": "string" + }, + "connector_name": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image_url": { + "type": "string" + } + }, + "required": [ + "id", + "customer_id", + "customer_name", + "user_id", + "updated_at", + "created_at", + "pipelines", + "name", + "description", + "type", + "properties", + "connector_id", + "connector_name", + "plugin", + "image_url" + ] + }, + "ConnectionDetailsRes": { + "type": "object", + "properties": { + "connection": { + "$ref": "#/components/schemas/ConnectionDto" + }, + "message": { + "type": "string" + } + }, + "required": [ + "connection", + "message" + ] + }, + "NetworkConfigToCatalogDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "type": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "network_type_id": { + "type": "string" + }, + "network_type_name": { + "type": "string" + } + }, + "required": [ + "id", + "customer_id", + "plugin", + "type", + "name", + "description", + "created_at", + "updated_at", + "network_type_id", + "network_type_name" + ] + }, + "FindAllNetworkConfigsRes": { + "type": "object", + "properties": { + "network_configs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/NetworkConfigToCatalogDto" + } + }, + "message": { + "type": "string" + } + }, + "required": [ + "network_configs", + "message" + ] + }, + "CreateNetworkConfigReq": { + "type": "object", + "properties": { + "network_type_id": { + "type": "string" + }, + "network_type_name": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "ovpn_file": { + "type": "string", + "format": "binary" + } + }, + "required": [ + "network_type_id", + "network_type_name", + "name", + "description", + "ovpn_file" + ] + }, + "CreateNetworkConfigRes": { + "type": "object", + "properties": { + "network_config": { + "$ref": "#/components/schemas/NetworkConfigToCatalogDto" + } + }, + "required": [ + "network_config" + ] + }, + "TableColumns": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "type": "string" + } + }, + "references": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "string" + } + }, + "required": [ + "name", + "columns", + "references", + "type" + ] + }, + "CreateInputReq": { + "type": "object", + "properties": { + "tables": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TableColumns" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "tables", + "name", + "description", + "plugin" + ] + }, + "Input": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "tables": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TableColumns" + } + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "type": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + }, + "required": [ + "id", + "tables", + "name", + "description", + "plugin", + "created_at", + "updated_at" + ] + }, + "ICreatePipelineV2Req": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "connection_id": { + "type": "string" + }, + "cron": { + "type": "string" + }, + "input_id": { + "type": "string" + }, + "transformations_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "properties": { + "type": "object" + }, + "connector_name": { + "type": "string" + }, + "connector_plugin": { + "type": "string" + }, + "connector_version": { + "type": "string" + }, + "image_url": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "connection_id", + "cron", + "connector_name", + "connector_plugin", + "connector_version", + "image_url" + ] + }, + "IPipelineV2": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "connection_id": { + "type": "string" + }, + "cron": { + "type": "string" + }, + "input_id": { + "type": "string" + }, + "transformations_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "properties": { + "type": "object" + }, + "connector_name": { + "type": "string" + }, + "connector_plugin": { + "type": "string" + }, + "connector_version": { + "type": "string" + }, + "image_url": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "description", + "connection_id", + "cron", + "connector_name", + "connector_plugin", + "connector_version", + "image_url", + "created_at", + "updated_at" + ] + }, + "IRole": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "name", + "id" + ] + }, + "IUser": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "username", + "id" + ] + }, + "IComment": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "message": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "required": [ + "id", + "message", + "created_at", + "username" + ] + }, + "EmbedObject": { + "type": "object", + "properties": { + "url": { + "type": "string" + } + }, + "required": [ + "url" + ] + }, + "IDataAsset": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "database_name": { + "type": "string" + }, + "table_name": { + "type": "string" + }, + "num_columns": { + "type": "number" + }, + "location": { + "type": "string" + }, + "created_time": { + "type": "string" + }, + "table_type": { + "type": "string" + }, + "size_in_bytes": { + "type": "number" + }, + "num_files": { + "type": "number" + }, + "data_encrypted": { + "type": "string" + }, + "num_rows": { + "type": "number" + }, + "display_name": { + "type": "string" + }, + "pipeline_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_asset_type": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "owner": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IRole" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IUser" + } + }, + "dashboard_id": { + "type": "number" + }, + "name": { + "type": "string" + }, + "parameters": { + "type": "array", + "items": { + "type": "string" + } + }, + "embedding_params": { + "type": "object" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IComment" + } + }, + "embed": { + "$ref": "#/components/schemas/EmbedObject" + }, + "share_type": { + "type": "string", + "enum": [ + "none", + "public", + "private" + ] + } + }, + "required": [ + "id", + "display_name", + "pipeline_id", + "user_id", + "description", + "data_asset_type", + "tags", + "owner", + "roles", + "users", + "created_at", + "comments" + ] + }, + "ICatalogAllResponse": { + "type": "object", + "properties": { + "data_assets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IDataAsset" + } + }, + "total": { + "type": "number" + } + }, + "required": [ + "data_assets", + "total" + ] + }, + "IColumnMetadata": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "table_name": { + "type": "string" + }, + "column_name": { + "type": "string" + }, + "data_type": { + "type": "string" + }, + "missing_count": { + "type": "string" + }, + "min": { + "type": "string" + }, + "max": { + "type": "string" + }, + "count": { + "type": "string" + }, + "histogram": { + "type": "string" + }, + "mean": { + "type": "string" + }, + "median": { + "type": "string" + }, + "missing_rate": { + "type": "string" + }, + "stddev": { + "type": "string" + }, + "unique_count": { + "type": "string" + }, + "unique_rate": { + "type": "string" + }, + "analyzer_rules": { + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "type": "string" + } + }, + "required": [ + "id", + "table_name", + "column_name", + "data_type", + "missing_count", + "min", + "max", + "count", + "histogram", + "mean", + "median", + "missing_rate", + "stddev", + "unique_count", + "unique_rate", + "analyzer_rules", + "version" + ] + }, + "IColumnsMetadataResponse": { + "type": "object", + "properties": { + "columns_metadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IColumnMetadata" + } + } + }, + "required": [ + "columns_metadata" + ] + }, + "IData": { + "type": "object", + "properties": { + "var": { + "type": "number" + }, + "date": { + "type": "string" + }, + "last": { + "type": "number" + }, + "maximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "day_opening": { + "type": "number" + } + }, + "required": [ + "var", + "date", + "last", + "maximum", + "minimum", + "day_opening" + ] + }, + "IPreview": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "database_name": { + "type": "string" + }, + "table_name": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IData" + } + } + }, + "required": [ + "id", + "database_name", + "table_name", + "data" + ] + }, + "IPreviewResponse": { + "type": "object", + "properties": { + "preview": { + "$ref": "#/components/schemas/IPreview" + } + }, + "required": [ + "preview" + ] + }, + "IDocs": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "docs": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "table_id": { + "type": "string" + } + }, + "required": [ + "id", + "docs", + "updated_at", + "table_id" + ] + }, + "IDocsResponse": { + "type": "object", + "properties": { + "docs": { + "$ref": "#/components/schemas/IDocs" + } + }, + "required": [ + "docs" + ] + }, + "IUpdateDataRequest": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "embed": { + "$ref": "#/components/schemas/EmbedObject" + }, + "share_type": { + "type": "string", + "enum": [ + "none", + "public", + "private" + ] + } + }, + "required": [ + "name", + "description", + "tags" + ] + }, + "IOneDataAsset": { + "type": "object", + "properties": { + "data_asset": { + "$ref": "#/components/schemas/IDataAsset" + } + }, + "required": [ + "data_asset" + ] + }, + "ICreateDataAsset": { + "type": "object", + "properties": { + "display_name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_asset_type": { + "type": "string" + }, + "external_url": { + "type": "string" + }, + "location": { + "type": "string" + }, + "embed": { + "$ref": "#/components/schemas/EmbedObject" + } + }, + "required": [ + "display_name", + "description", + "data_asset_type", + "external_url", + "location" + ] + }, + "IMakeAComment": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + }, + "required": [ + "message" + ] + }, + "CommentToDelete": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "username": { + "type": "string" + } + }, + "required": [ + "id", + "username" + ] + }, + "IDeleteComment": { + "type": "object", + "properties": { + "comment": { + "$ref": "#/components/schemas/CommentToDelete" + } + }, + "required": [ + "comment" + ] + }, + "ConnectionTestPingReq": { + "type": "object", + "properties": { + "plugin": { + "type": "string" + }, + "host": { + "type": "string" + }, + "port": { + "type": "number" + }, + "network_config_id": { + "type": "string" + }, + "connection_id": { + "type": "string" + } + } + }, + "ConnectionTestPingRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + } + }, + "required": [ + "operation_result" + ] + }, + "ConnectionTestCredentialsProperties": { + "type": "object", + "properties": { + "host": { + "type": "string" + }, + "port": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "database": { + "type": "string" + } + }, + "required": [ + "host", + "port", + "username", + "password", + "database" + ] + }, + "ConnectionTestCredentialsReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "connector_id": { + "type": "string" + }, + "connector_name": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image_url": { + "type": "string" + }, + "properties": { + "$ref": "#/components/schemas/ConnectionTestCredentialsProperties" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "type", + "connector_id", + "connector_name", + "plugin", + "image_url", + "properties" + ] + }, + "ConnectionTestCredentialsRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "operation_result", + "connection_id" + ] + }, + "ConnectionTestListSchemasReq": { + "type": "object", + "properties": { + "plugin": { + "type": "string" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "plugin", + "connection_id" + ] + }, + "ConnectionTestListSchemasRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "schema_list": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "operation_result", + "schema_list" + ] + }, + "ConnectionTestListTablesReq": { + "type": "object", + "properties": { + "plugin": { + "type": "string" + }, + "connection_id": { + "type": "string" + }, + "schema": { + "type": "string" + } + }, + "required": [ + "plugin", + "connection_id", + "schema" + ] + }, + "ConnectionTestListTablesRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "table_list": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "operation_result", + "table_list" + ] + }, + "GetTableMetadataReq": { + "type": "object", + "properties": { + "connection_id": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "schema": { + "type": "string" + }, + "table_list": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "connection_id", + "plugin", + "schema", + "table_list" + ] + }, + "ColumnDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "name", + "type" + ] + }, + "TableMetadataDto": { + "type": "object", + "properties": { + "table_name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ColumnDto" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ColumnDto" + } + } + }, + "required": [ + "table_name", + "columns", + "references" + ] + }, + "GetTableMetadataRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "tables_metadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TableMetadataDto" + } + } + }, + "required": [ + "operation_result", + "tables_metadata" + ] + } + } + } + } +} \ No newline at end of file diff --git a/docsfera.json b/docsfera.json index 60424aa..1fdca24 100644 --- a/docsfera.json +++ b/docsfera.json @@ -49,45 +49,6 @@ ] } }, - "/auth/sso/snowflake": { - "post": { - "operationId": "AuthController_snowflakeSignIn", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, "/auth/refresh-access-token": { "post": { "operationId": "AuthController_refreshAccessToken", @@ -132,935 +93,6 @@ ] } }, - "/auth/change-password": { - "post": { - "operationId": "AuthController_changePassword", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/reset-password": { - "post": { - "operationId": "AuthController_resetPassword", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/verify-reset-password-code": { - "post": { - "operationId": "AuthController_verifyResetPasswordCode", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/confirm-reset-password": { - "post": { - "operationId": "AuthController_confirmResetPassword", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/enable-totp": { - "post": { - "operationId": "AuthController_enableTotpMFA", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/disable-totp": { - "post": { - "operationId": "AuthController_disableTotpMFA", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/dismiss-totp": { - "post": { - "operationId": "AuthController_dismissTotpMFA", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/verify-totp": { - "post": { - "operationId": "AuthController_verifyTotp", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/verify-access-token": { - "get": { - "operationId": "AuthController_verifyAccessToken", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Auth" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/auth/session/{session}": { - "get": { - "operationId": "AuthController_getSession", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "session", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/oauth/google": { - "get": { - "operationId": "AuthController_googleOauth", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "boolean" - } - } - } - } - }, - "tags": [ - "Auth" - ] - } - }, - "/auth/oauth/google/callback": { - "get": { - "operationId": "AuthController_googleOauthCallback", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Auth" - ] - } - }, - "/connectors": { - "post": { - "operationId": "ConnectorController_uploadConnector", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/CreateConnectorDto" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "get": { - "operationId": "ConnectorController_getAllConnectors", - "parameters": [ - { - "name": "search", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "language", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "size", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "page", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/uploads": { - "post": { - "operationId": "ConnectorController_uploadFile", - "parameters": [], - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object" - } - } - } - } - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/multiple-connectors-upload": { - "post": { - "operationId": "ConnectorController_uploadConnectorsFile", - "parameters": [], - "responses": { - "201": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/tags": { - "get": { - "operationId": "ConnectorController_getConnectorsTags", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/{plugin}": { - "get": { - "operationId": "ConnectorController_getConnector", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - }, - { - "name": "version", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "put": { - "operationId": "ConnectorController_updateConnector", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/UpdateDto" - } - } - } - }, - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "ConnectorController_deleteConnector", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - }, - { - "name": "version", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/{plugin}/details": { - "get": { - "operationId": "ConnectorController_getConnectorDetails", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - }, - { - "name": "version", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/{plugin}/add-tag": { - "put": { - "operationId": "ConnectorController_addTagOnConnector", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddTagDto" - } - } - } - }, - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/connectors/{plugin}/remove-tag": { - "put": { - "operationId": "ConnectorController_removeTagOnConnector", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RemoveTagDto" - } - } - } - }, - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "connectors" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/permissions": { - "get": { - "operationId": "PermissionsController_getPublicPermissions", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "description": "Defaults to pt-br", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPublicPermissionsRes" - } - } - } - } - }, - "tags": [ - "Permissions" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/terms-of-use/token": { - "get": { - "operationId": "TermsOfUseController_getToken", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "TermsOfUse" - ] - } - }, - "/terms-of-use/accept": { - "post": { - "operationId": "TermsOfUseController_accept", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "TermsOfUse" - ] - } - }, "/connections": { "post": { "operationId": "ConnectionController_createConnection", @@ -1232,1179 +264,6 @@ ] } }, - "/users": { - "get": { - "operationId": "UsersController_getAllUsersByCustomerId", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllUsersByCustomerIdRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "post": { - "operationId": "UsersController_createUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateUserReq" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateUserRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/hierarchies": { - "get": { - "operationId": "UsersController_getAllHierarchies", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllHierarchiesRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/departments": { - "get": { - "operationId": "UsersController_getAllDepartments", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllDepartmentsRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/jobTitles": { - "get": { - "operationId": "UsersController_getAllJobTitles", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllDepartmentsRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/{id}": { - "get": { - "operationId": "UsersController_findOneById", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IUserByCustomer" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "UsersController_deleteUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeleteUserRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "patch": { - "operationId": "UsersController_updateUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateUserReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateUserRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/batch": { - "post": { - "operationId": "UsersController_batchCreateUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BatchCreateUserReq" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BatchCreateUserRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/{id}/resend-invite": { - "post": { - "operationId": "UsersController_resendInvite", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/role": { - "delete": { - "operationId": "UsersController_unassignRoleToUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "userId", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "roleId", - "required": true, - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "put": { - "operationId": "UsersController_assignRoleToUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssignRoleToUserReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/roles": { - "patch": { - "operationId": "UsersController_setUserRoles", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetUserRolesReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetUserRolesRes" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/users/synchronize/{id}": { - "post": { - "operationId": "UsersController_synchronizeUser", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateUserRes" - } - } - } - }, - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Users" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/roles": { - "get": { - "operationId": "RolesController_searchRoles", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "permissionId", - "required": false, - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "getUsers", - "required": false, - "in": "query", - "schema": { - "enum": [ - "true", - "false" - ], - "type": "string" - } - }, - { - "name": "canUntoggleLogic", - "required": false, - "in": "query", - "schema": { - "enum": [ - "data_assets_sharing" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetRolesByCustomerRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "post": { - "operationId": "RolesController_createRole", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRoleReq" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRoleRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/roles/permissions": { - "put": { - "operationId": "RolesController_grantPermissionsToRole", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GrantPermissionsToRoleReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GrantPermissionsToRoleRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "RolesController_revokePermissionsFromRole", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RevokePermissionsFromRoleReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RevokePermissionsFromRoleRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "patch": { - "operationId": "RolesController_setRolePermissions", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetRolePermissionsReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetRolePermissionsRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/roles/users": { - "patch": { - "operationId": "RolesController_setRoleUsers", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetRoleUsersReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SetRoleUsersRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/roles/{id}": { - "get": { - "operationId": "RolesController_getRoleById", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RoleDto" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "RolesController_deleteRole", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "patch": { - "operationId": "RolesController_updateRole", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateRoleReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateRoleRes" - } - } - } - } - }, - "tags": [ - "Roles" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, "/network-config": { "get": { "operationId": "NetworkConfigController_findAllNetworkConfigs", @@ -2548,16 +407,16 @@ ] } }, - "/connection-test/ping": { + "/inputs": { "post": { - "operationId": "ConnectionTestController_connectionTestPing", + "operationId": "InputsController_create", "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConnectionTestPingReq" + "$ref": "#/components/schemas/CreateInputReq" } } } @@ -2568,204 +427,28 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ConnectionTestPingRes" + "$ref": "#/components/schemas/Input" } } } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/credentials": { - "post": { - "operationId": "ConnectionTestController_connectionTestCredentials", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestCredentialsReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestCredentialsRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/schemas": { - "post": { - "operationId": "ConnectionTestController_connectionTestListSchemas", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListSchemasReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListSchemasRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/tables": { - "post": { - "operationId": "ConnectionTestController_connectionTestListTables", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListTablesReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListTablesRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/table-metadata": { - "post": { - "operationId": "ConnectionTestController_getTableMetadata", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetTableMetadataReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetTableMetadataRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/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": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } + "description": "" } }, "tags": [ - "Pipelines" + "Inputs" ], "security": [ - { - "access-token": [] - }, { "access-token": [] } ] } }, - "/pipelines/{id}/status": { + "/inputs/{id}": { "get": { - "operationId": "PipelinesController_getPipelineStatus", - "summary": "", - "deprecated": true, - "description": "This method is deprecated. Please use route /pipelinesV2/:id/status instead", + "operationId": "InputsController_findOne", "parameters": [], "responses": { "200": { @@ -2780,12 +463,9 @@ } }, "tags": [ - "Pipelines" + "Inputs" ], "security": [ - { - "access-token": [] - }, { "access-token": [] } @@ -3089,46 +769,6 @@ } ] }, - "put": { - "operationId": "PipelinesController_updateDeprecated", - "summary": "", - "deprecated": true, - "description": "This method is deprecated. Please use PATCH instead", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "PipelinesV2" - ], - "security": [ - { - "access-token": [] - } - ] - }, "delete": { "operationId": "PipelinesController_delete", "parameters": [ @@ -3160,507 +800,6 @@ ] } }, - "/pipelinesV2/init-upload": { - "post": { - "operationId": "PipelinesController_initUploadFile", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/IInitUploadCSVFile" - } - } - } - }, - "responses": { - "201": { - "description": "" - } - }, - "tags": [ - "PipelinesV2" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/pipelinesV2/complete-upload": { - "post": { - "operationId": "PipelinesController_completeUploadFile", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ICompleteUploadCSVFile" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "PipelinesV2" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/pipelinesV2/file": { - "post": { - "operationId": "PipelinesController_uploadedFile", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ICreatePipelineCSVFile" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "PipelinesV2" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/pipelinesV2/start/{id}": { - "post": { - "operationId": "PipelinesController_activate", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "PipelinesV2" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/inputs/available-entities/{plugin}": { - "get": { - "operationId": "InputsController_getAvailableEntities", - "parameters": [ - { - "name": "plugin", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAvailableEntitiesRes" - } - } - } - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/inputs": { - "post": { - "operationId": "InputsController_create", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateInputReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Input" - } - } - } - }, - "201": { - "description": "" - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "get": { - "operationId": "InputsController_findAll", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/inputs/{id}": { - "get": { - "operationId": "InputsController_findOne", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "patch": { - "operationId": "InputsController_update", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "InputsController_delete", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Inputs" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/transformations": { - "post": { - "operationId": "TransformationsController_create", - "parameters": [], - "responses": { - "201": { - "description": "" - } - }, - "tags": [ - "Transformations" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "get": { - "operationId": "TransformationsController_findAll", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Transformations" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/transformations/{id}": { - "get": { - "operationId": "TransformationsController_findOne", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Transformations" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "put": { - "operationId": "TransformationsController_update", - "parameters": [ - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Transformations" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - }, - "delete": { - "operationId": "TransformationsController_delete", - "parameters": [], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Transformations" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, - "/health": { - "get": { - "operationId": "HealthController_check", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Health" - ] - } - }, "/catalog": { "get": { "operationId": "CatalogController_searchCatalog", @@ -3769,80 +908,6 @@ ] } }, - "/catalog/data-asset": { - "get": { - "operationId": "CatalogController_findByPipelineAndObject", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Catalog" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/catalog/tags": { - "get": { - "operationId": "CatalogController_findAllTags", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Catalog" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, "/catalog/data-asset/{id}": { "get": { "operationId": "CatalogController_getDataAsset", @@ -3984,41 +1049,6 @@ ] } }, - "/catalog/data-asset/rls/{id}": { - "get": { - "operationId": "CatalogController_getDataAssetRls", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Catalog" - ], - "security": [ - { - "access-token": [] - }, - { - "access-token": [] - } - ] - } - }, "/catalog/data-asset/{id}/columns-metadata": { "get": { "operationId": "CatalogController_getDataAssetColumnsMetadata", @@ -4193,86 +1223,6 @@ ] } }, - "/catalog/data-asset/{id}/manage-permissions": { - "put": { - "operationId": "CatalogController_manageDataAssetPermissions", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Catalog" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/catalog/data-asset/{id}/revoke-permissions": { - "put": { - "operationId": "CatalogController_revokeDataAssetPermissions", - "parameters": [ - { - "name": "dadosfera-lang", - "in": "header", - "required": false, - "schema": { - "enum": [ - "pt-br", - "en-us" - ], - "type": "string" - } - }, - { - "name": "id", - "required": true, - "in": "path", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "Catalog" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, "/catalog/data-asset/{id}/comment": { "post": { "operationId": "CatalogController_commentOnDataAsset", @@ -4391,6 +1341,186 @@ ] } }, + "/connection-test/ping": { + "post": { + "operationId": "ConnectionTestController_connectionTestPing", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestPingReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestPingRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/credentials": { + "post": { + "operationId": "ConnectionTestController_connectionTestCredentials", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestCredentialsReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestCredentialsRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/schemas": { + "post": { + "operationId": "ConnectionTestController_connectionTestListSchemas", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListSchemasReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListSchemasRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/tables": { + "post": { + "operationId": "ConnectionTestController_connectionTestListTables", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListTablesReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConnectionTestListTablesRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connection-test/table-metadata": { + "post": { + "operationId": "ConnectionTestController_getTableMetadata", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTableMetadataReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetTableMetadataRes" + } + } + } + } + }, + "tags": [ + "Connection Test" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, "/oauth/hubspot": { "get": { "operationId": "OauthController_oauthHubspot", @@ -4412,20 +1542,6 @@ ] } }, - "/oauth/hubspot/callback": { - "get": { - "operationId": "OauthController_oauthHubspotCallback", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "oauth" - ] - } - }, "/oauth/googleads": { "get": { "operationId": "OauthController_oauthGoogleAds", @@ -4447,20 +1563,6 @@ ] } }, - "/oauth/googleads/callback": { - "get": { - "operationId": "OauthController_oauthGoogleAdsCallback", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "oauth" - ] - } - }, "/oauth/google-sheets": { "get": { "operationId": "OauthController_oauthGoogleSheets", @@ -4482,20 +1584,6 @@ ] } }, - "/oauth/google-sheets/callback": { - "get": { - "operationId": "OauthController_oauthGoogleSheetsCallback", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "oauth" - ] - } - }, "/oauth/facebook": { "get": { "operationId": "OauthController_oauthFacebook", @@ -4517,20 +1605,6 @@ ] } }, - "/oauth/facebook/callback": { - "get": { - "operationId": "OauthController_oauthFacebookCallback", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "oauth" - ] - } - }, "/oauth/mailchimp": { "get": { "operationId": "OauthController_oauthMailchimp", @@ -4552,20 +1626,6 @@ ] } }, - "/oauth/mailchimp/callback": { - "get": { - "operationId": "OauthController_oauthMailchimpCallback", - "parameters": [], - "responses": { - "200": { - "description": "" - } - }, - "tags": [ - "oauth" - ] - } - }, "/oauth/salesforce": { "get": { "operationId": "OauthController_oauthSalesforce", @@ -4587,9 +1647,9 @@ ] } }, - "/oauth/salesforce/callback": { + "/health": { "get": { - "operationId": "OauthController_oauthSalesforceCallback", + "operationId": "HealthController_check", "parameters": [], "responses": { "200": { @@ -4597,59 +1657,7 @@ } }, "tags": [ - "oauth" - ] - } - }, - "/productboard/notes": { - "post": { - "operationId": "ProductboardController_sendNote", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/INote" - } - } - } - }, - "responses": { - "201": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - } - }, - "tags": [ - "Productboard" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/trackEvent/{id}": { - "post": { - "operationId": "MixpanelController_trackEvent", - "parameters": [], - "responses": { - "201": { - "description": "" - } - }, - "security": [ - { - "access-token": [] - } + "Health" ] } } @@ -4879,137 +1887,6 @@ "accessToken" ] }, - "CreateConnectorDto": { - "type": "object", - "properties": { - "file": { - "type": "string", - "format": "binary" - }, - "connector": { - "type": "string" - } - }, - "required": [ - "file", - "connector" - ] - }, - "UpdateDto": { - "type": "object", - "properties": { - "file": { - "type": "string", - "format": "binary" - }, - "version": { - "type": "string" - }, - "category": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "image": { - "type": "string" - }, - "docs": { - "type": "string" - }, - "name": { - "type": "string" - }, - "options": { - "type": "object", - "description": "skip_select_entities: boolean skip_select_columns: boolean;" - }, - "connection_controls": { - "type": "array", - "items": { - "properties": {} - } - } - }, - "required": [ - "version" - ] - }, - "AddTagDto": { - "type": "object", - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "tags" - ] - }, - "RemoveTagDto": { - "type": "object", - "properties": { - "tags": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "tags" - ] - }, - "PermissionGroupPermission": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "id": { - "type": "number" - } - }, - "required": [ - "name", - "id" - ] - }, - "PermissionGroup": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PermissionGroupPermission" - } - } - }, - "required": [ - "title", - "permissions" - ] - }, - "GetPublicPermissionsRes": { - "type": "object", - "properties": { - "permissionGroups": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PermissionGroup" - } - } - }, - "required": [ - "permissionGroups" - ] - }, "CreateConnectionDto": { "type": "object", "properties": { @@ -5230,844 +2107,6 @@ "message" ] }, - "PermissionDto": { - "type": "object", - "properties": { - "id": { - "type": "number" - }, - "seqid": { - "type": "number" - }, - "name": { - "type": "string" - }, - "claim": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - }, - "required": [ - "id", - "seqid", - "name", - "claim", - "createdAt", - "updatedAt" - ] - }, - "Customer": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "domain": { - "type": "string" - }, - "tier": { - "type": "string" - }, - "info": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - }, - "required": [ - "id", - "name", - "domain", - "tier", - "info", - "createdAt", - "updatedAt" - ] - }, - "UserRole": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PermissionDto" - } - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "isPublic": { - "type": "boolean" - }, - "customer": { - "$ref": "#/components/schemas/Customer" - }, - "usage": { - "type": "string" - }, - "canUntoggle": { - "type": "boolean", - "description": "Whether this role can be untoggled" - } - }, - "required": [ - "id", - "name", - "description", - "createdAt", - "updatedAt", - "isPublic", - "customer", - "usage" - ] - }, - "IUserByCustomer": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRole" - } - }, - "jobTitle": { - "type": "string" - }, - "department": { - "type": "string" - }, - "hierarchy": { - "type": "string" - }, - "mfaStatus": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "status": { - "type": "string" - }, - "lastLogin": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "id", - "name", - "email", - "roles", - "jobTitle", - "department", - "hierarchy", - "mfaStatus", - "createdAt", - "updatedAt", - "status" - ] - }, - "GetAllUsersByCustomerIdRes": { - "type": "object", - "properties": { - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/IUserByCustomer" - } - }, - "departments": { - "type": "array", - "items": { - "type": "string" - } - }, - "jobTitles": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "users", - "departments", - "jobTitles" - ] - }, - "Hierarchy": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ] - }, - "GetAllHierarchiesRes": { - "type": "object", - "properties": { - "hierarchies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Hierarchy" - } - } - }, - "required": [ - "hierarchies" - ] - }, - "GetAllDepartmentsRes": { - "type": "object", - "properties": { - "departments": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "departments" - ] - }, - "CreateUserReq": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "roleNames": { - "type": "array", - "items": { - "type": "string" - } - }, - "jobTitle": { - "type": "string" - }, - "department": { - "type": "string" - }, - "hierarchy": { - "type": "string" - } - }, - "required": [ - "email" - ] - }, - "User": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "roles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRole" - } - }, - "jobTitle": { - "type": "string" - }, - "department": { - "type": "string" - }, - "hierarchy": { - "type": "string" - }, - "customer": { - "$ref": "#/components/schemas/Customer" - }, - "mfaStatus": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "status": { - "type": "string" - }, - "lastLogin": { - "type": "string" - } - }, - "required": [ - "id", - "name", - "email", - "roles", - "jobTitle", - "department", - "hierarchy", - "mfaStatus", - "createdAt", - "updatedAt", - "status" - ] - }, - "CreateUserRes": { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/User" - } - }, - "required": [ - "user" - ] - }, - "BatchCreateUserReq": { - "type": "object", - "properties": { - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateUserReq" - } - } - }, - "required": [ - "users" - ] - }, - "ErrorUsers": { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/CreateUserReq" - }, - "error": { - "type": "string" - } - }, - "required": [ - "user", - "error" - ] - }, - "BatchCreateUserRes": { - "type": "object", - "properties": { - "usersCreated": { - "type": "array", - "items": { - "$ref": "#/components/schemas/User" - } - }, - "errorUsers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorUsers" - } - } - }, - "required": [ - "usersCreated", - "errorUsers" - ] - }, - "DeleteUserRes": { - "type": "object", - "properties": { - "id": { - "type": "string" - } - }, - "required": [ - "id" - ] - }, - "SetUserRolesReq": { - "type": "object", - "properties": { - "userId": { - "type": "string" - }, - "roleNames": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "userId", - "roleNames" - ] - }, - "SetUserRolesRes": { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/IUserByCustomer" - } - }, - "required": [ - "user" - ] - }, - "AssignRoleToUserReq": { - "type": "object", - "properties": { - "userId": { - "type": "string" - }, - "roleId": { - "type": "string" - } - }, - "required": [ - "userId", - "roleId" - ] - }, - "UpdateUserReq": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "jobTitle": { - "type": "string" - }, - "department": { - "type": "string" - }, - "hierarchy": { - "type": "string" - }, - "roleNames": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "UpdateUserRes": { - "type": "object", - "properties": { - "user": { - "$ref": "#/components/schemas/IUserByCustomer" - } - }, - "required": [ - "user" - ] - }, - "UserNoRolesAndCustomer": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "jobTitle": { - "type": "string" - }, - "department": { - "type": "string" - }, - "hierarchy": { - "type": "string" - }, - "mfaStatus": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "status": { - "type": "string" - }, - "lastLogin": { - "type": "string" - } - }, - "required": [ - "id", - "name", - "email", - "jobTitle", - "department", - "hierarchy", - "mfaStatus", - "createdAt", - "updatedAt", - "status" - ] - }, - "RoleDto": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PermissionDto" - } - }, - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserNoRolesAndCustomer" - } - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "isPublic": { - "type": "boolean" - }, - "customer": { - "$ref": "#/components/schemas/Customer" - }, - "usage": { - "type": "string" - }, - "canUntoggle": { - "type": "boolean", - "description": "Whether this role can be untoggled" - } - }, - "required": [ - "id", - "name", - "description", - "createdAt", - "updatedAt", - "isPublic", - "customer", - "usage" - ] - }, - "GetRolesByCustomerRes": { - "type": "object", - "properties": { - "roles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RoleDto" - } - } - }, - "required": [ - "roles" - ] - }, - "CreateRoleReq": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "permissionIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "userIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "type": "string" - } - }, - "required": [ - "name", - "permissionIds", - "description" - ] - }, - "CustomerRole": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "permissions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PermissionDto" - } - }, - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserNoRolesAndCustomer" - } - }, - "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "isPublic": { - "type": "boolean" - }, - "usage": { - "type": "string" - }, - "canUntoggle": { - "type": "boolean", - "description": "Whether this role can be untoggled" - } - }, - "required": [ - "id", - "name", - "description", - "createdAt", - "updatedAt", - "isPublic", - "usage" - ] - }, - "CreateRoleRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/CustomerRole" - } - }, - "required": [ - "role" - ] - }, - "GrantPermissionsToRoleReq": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "permissionIds": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "roleId", - "permissionIds" - ] - }, - "GrantPermissionsToRoleRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleDto" - } - }, - "required": [ - "role" - ] - }, - "RevokePermissionsFromRoleReq": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "permissionIds": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "roleId", - "permissionIds" - ] - }, - "RevokePermissionsFromRoleRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleDto" - } - }, - "required": [ - "role" - ] - }, - "SetRolePermissionsReq": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "permissionIds": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "roleId", - "permissionIds" - ] - }, - "SetRolePermissionsRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleDto" - } - }, - "required": [ - "role" - ] - }, - "SetRoleUsersReq": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "userIds": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "roleId", - "userIds" - ] - }, - "SetRoleUsersRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleDto" - } - }, - "required": [ - "role" - ] - }, - "UpdateRoleReq": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, - "UpdateRoleRes": { - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleDto" - } - }, - "required": [ - "role" - ] - }, "NetworkConfigToCatalogDto": { "type": "object", "properties": { @@ -6172,276 +2211,103 @@ "network_config" ] }, - "ConnectionTestPingReq": { + "TableColumns": { "type": "object", "properties": { - "plugin": { + "name": { "type": "string" }, - "host": { - "type": "string" + "columns": { + "type": "array", + "items": { + "type": "string" + } }, - "port": { - "type": "number" + "references": { + "type": "array", + "items": { + "type": "string" + } }, - "network_config_id": { - "type": "string" - }, - "connection_id": { - "type": "string" - } - } - }, - "ConnectionTestPingRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - } - }, - "required": [ - "operation_result" - ] - }, - "ConnectionTestCredentialsProperties": { - "type": "object", - "properties": { - "host": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "password": { - "type": "string" - }, - "database": { + "type": { "type": "string" } }, "required": [ - "host", - "port", - "username", - "password", - "database" + "name", + "columns", + "references", + "type" ] }, - "ConnectionTestCredentialsReq": { + "CreateInputReq": { "type": "object", "properties": { + "tables": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TableColumns" + } + }, "name": { "type": "string" }, "description": { "type": "string" }, + "plugin": { + "type": "string" + }, "type": { "type": "string" - }, - "network_config_id": { - "type": "string" - }, - "connector_id": { - "type": "string" - }, - "connector_name": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "image_url": { - "type": "string" - }, - "properties": { - "$ref": "#/components/schemas/ConnectionTestCredentialsProperties" - }, - "connection_id": { - "type": "string" } }, "required": [ + "tables", "name", "description", - "type", - "connector_id", - "connector_name", - "plugin", - "image_url", - "properties" + "plugin" ] }, - "ConnectionTestCredentialsRes": { + "Input": { "type": "object", "properties": { - "operation_result": { - "type": "boolean" - }, - "connection_id": { - "type": "string" - } - }, - "required": [ - "operation_result", - "connection_id" - ] - }, - "ConnectionTestListSchemasReq": { - "type": "object", - "properties": { - "plugin": { + "id": { "type": "string" }, - "connection_id": { - "type": "string" - } - }, - "required": [ - "plugin", - "connection_id" - ] - }, - "ConnectionTestListSchemasRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "schema_list": { + "tables": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/TableColumns" } - } - }, - "required": [ - "operation_result", - "schema_list" - ] - }, - "ConnectionTestListTablesReq": { - "type": "object", - "properties": { - "plugin": { - "type": "string" }, - "connection_id": { - "type": "string" - }, - "schema": { - "type": "string" - } - }, - "required": [ - "plugin", - "connection_id", - "schema" - ] - }, - "ConnectionTestListTablesRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "table_list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "operation_result", - "table_list" - ] - }, - "GetTableMetadataReq": { - "type": "object", - "properties": { - "connection_id": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "schema": { - "type": "string" - }, - "table_list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "connection_id", - "plugin", - "schema", - "table_list" - ] - }, - "ColumnDto": { - "type": "object", - "properties": { "name": { "type": "string" }, + "description": { + "type": "string" + }, + "plugin": { + "type": "string" + }, "type": { "type": "string" - } - }, - "required": [ - "name", - "type" - ] - }, - "TableMetadataDto": { - "type": "object", - "properties": { - "table_name": { + }, + "created_at": { "type": "string" }, - "columns": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ColumnDto" - } - }, - "references": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ColumnDto" - } + "updated_at": { + "type": "string" } }, "required": [ - "table_name", - "columns", - "references" - ] - }, - "GetTableMetadataRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "tables_metadata": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TableMetadataDto" - } - } - }, - "required": [ - "operation_result", - "tables_metadata" + "id", + "tables", + "name", + "description", + "plugin", + "created_at", + "updated_at" ] }, "ICreatePipelineV2Req": { @@ -6570,205 +2436,6 @@ "updated_at" ] }, - "IInitUploadCSVFile": { - "type": "object", - "properties": { - "file_name": { - "type": "string" - }, - "parts": { - "type": "number" - } - }, - "required": [ - "file_name", - "parts" - ] - }, - "ICompleteUploadCSVFile": { - "type": "object", - "properties": { - "upload_id": { - "type": "string" - }, - "file_name": { - "type": "string" - }, - "parts": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "upload_id", - "file_name", - "parts" - ] - }, - "ICreatePipelineCSVFile": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "file_name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "encoding": { - "type": "string" - }, - "sep": { - "type": "string" - }, - "header": { - "type": "boolean" - } - }, - "required": [ - "name", - "file_name", - "description", - "encoding", - "sep", - "header" - ] - }, - "AvailableEntity": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "replication_methods": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "name", - "replication_methods" - ] - }, - "GetAvailableEntitiesRes": { - "type": "object", - "properties": { - "entities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/AvailableEntity" - } - } - }, - "required": [ - "entities" - ] - }, - "TableColumns": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "columns": { - "type": "array", - "items": { - "type": "string" - } - }, - "references": { - "type": "array", - "items": { - "type": "string" - } - }, - "type": { - "type": "string" - } - }, - "required": [ - "name", - "columns", - "references", - "type" - ] - }, - "CreateInputReq": { - "type": "object", - "properties": { - "tables": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TableColumns" - } - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "required": [ - "tables", - "name", - "description", - "plugin" - ] - }, - "Input": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "tables": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TableColumns" - } - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "type": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "string" - } - }, - "required": [ - "id", - "tables", - "name", - "description", - "plugin", - "created_at", - "updated_at" - ] - }, "IRole": { "type": "object", "properties": { @@ -7282,16 +2949,146 @@ "comment" ] }, - "INote": { + "ConnectionTestPingReq": { "type": "object", "properties": { - "title": { + "plugin": { "type": "string" }, - "content": { + "host": { "type": "string" }, - "tags": { + "port": { + "type": "number" + }, + "network_config_id": { + "type": "string" + }, + "connection_id": { + "type": "string" + } + } + }, + "ConnectionTestPingRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + } + }, + "required": [ + "operation_result" + ] + }, + "ConnectionTestCredentialsProperties": { + "type": "object", + "properties": { + "host": { + "type": "string" + }, + "port": { + "type": "string" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "database": { + "type": "string" + } + }, + "required": [ + "host", + "port", + "username", + "password", + "database" + ] + }, + "ConnectionTestCredentialsReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string" + }, + "network_config_id": { + "type": "string" + }, + "connector_id": { + "type": "string" + }, + "connector_name": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image_url": { + "type": "string" + }, + "properties": { + "$ref": "#/components/schemas/ConnectionTestCredentialsProperties" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "type", + "connector_id", + "connector_name", + "plugin", + "image_url", + "properties" + ] + }, + "ConnectionTestCredentialsRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "operation_result", + "connection_id" + ] + }, + "ConnectionTestListSchemasReq": { + "type": "object", + "properties": { + "plugin": { + "type": "string" + }, + "connection_id": { + "type": "string" + } + }, + "required": [ + "plugin", + "connection_id" + ] + }, + "ConnectionTestListSchemasRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "schema_list": { "type": "array", "items": { "type": "string" @@ -7299,9 +3096,129 @@ } }, "required": [ - "title", - "content", - "tags" + "operation_result", + "schema_list" + ] + }, + "ConnectionTestListTablesReq": { + "type": "object", + "properties": { + "plugin": { + "type": "string" + }, + "connection_id": { + "type": "string" + }, + "schema": { + "type": "string" + } + }, + "required": [ + "plugin", + "connection_id", + "schema" + ] + }, + "ConnectionTestListTablesRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "table_list": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "operation_result", + "table_list" + ] + }, + "GetTableMetadataReq": { + "type": "object", + "properties": { + "connection_id": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "schema": { + "type": "string" + }, + "table_list": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "connection_id", + "plugin", + "schema", + "table_list" + ] + }, + "ColumnDto": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "name", + "type" + ] + }, + "TableMetadataDto": { + "type": "object", + "properties": { + "table_name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ColumnDto" + } + }, + "references": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ColumnDto" + } + } + }, + "required": [ + "table_name", + "columns", + "references" + ] + }, + "GetTableMetadataRes": { + "type": "object", + "properties": { + "operation_result": { + "type": "boolean" + }, + "tables_metadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TableMetadataDto" + } + } + }, + "required": [ + "operation_result", + "tables_metadata" ] } } diff --git a/environment.d.ts b/environment.d.ts new file mode 100644 index 0000000..727c484 --- /dev/null +++ b/environment.d.ts @@ -0,0 +1,18 @@ +declare global { + namespace NodeJS { + interface ProcessEnv { + NODE_ENV: 'test'; + ENV: 'local' | 'stg' | 'prd' | 'test'; + LOCAL_ENV: 'stg' | 'prd'; + + DUC_URL: string; + INFACTORY_URL: string; + PIFACTORY_URL: string; + + INTERNAL_SWAGGER: 'true' | 'false'; + + AWS_REGION: string; + } + } +} +export {}; diff --git a/src/app.module.ts b/src/app.module.ts index d736888..22ea09a 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -40,24 +40,24 @@ import { MixpanelModule } from './modules/mixpanel/mixpanel.module'; isGlobal: true, }), AuthModule, + ConnectionModule, + NetworkConfigModule, + InputsModule, + PipelinesV2Module, + CatalogModule, ConnectorModule, PermissionsModule, TermsOfUseModule, - ConnectionModule, - NetworkConfigModule, ConnectionTestModule, PipelinesModule, - PipelinesV2Module, TransformationsModule, - HealthModule, - CatalogModule, UsersModule, RolesModule, - InputsModule, OauthModule, - CatalogModule, ProductboardModule, MixpanelModule, + //Always leave HealthModule last, so it is on the bottom of swagger + HealthModule, ], }) export class AppModule {} diff --git a/src/decorators/swagger.decorator.ts b/src/decorators/swagger.decorator.ts new file mode 100644 index 0000000..342eb69 --- /dev/null +++ b/src/decorators/swagger.decorator.ts @@ -0,0 +1,13 @@ +import { applyDecorators } from '@nestjs/common'; +import { ApiExcludeController, ApiExcludeEndpoint } from '@nestjs/swagger'; + +export function ApiInternalOnlyEndpoint() { + if (process.env.INTERNAL_SWAGGER !== 'true') + return applyDecorators(ApiExcludeEndpoint()); + return () => null; +} +export function ApiInternalOnlyController() { + if (process.env.INTERNAL_SWAGGER !== 'true') + return applyDecorators(ApiExcludeController()); + return () => null; +} diff --git a/src/main.ts b/src/main.ts index 1fe7ee5..12d4b73 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,7 +14,7 @@ async function bootstrap() { serviceEnvironment: process.env.ENV, }); const logger = new DadosferaLogger(); - + process.env.INTERNAL_SWAGGER = 'true'; const app = await NestFactory.create(AppModule, { logger, cors: { @@ -24,9 +24,20 @@ async function bootstrap() { optionsSuccessStatus: 204, }, }); + process.env.INTERNAL_SWAGGER = 'true'; + const app2 = await NestFactory.create(AppModule, { + logger, + cors: { + origin: '*', + methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', + preflightContinue: false, + optionsSuccessStatus: 204, + }, + }); app.use(helmet()); configureSwagger(app); + // configureSwagger(app2); await app.listen(3333); } @@ -56,9 +67,14 @@ function configureSwagger(app: INestApplication) { const document = SwaggerModule.createDocument(app, config); + let swaggerJsonFile = 'docsfera.external.json'; + if (process.env.INTERNAL_SWAGGER === 'true') { + swaggerJsonFile = 'docsfera.json'; + } if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document); + writeFileSync( - 'docsfera.json', + swaggerJsonFile, JSON.stringify( { service: '${DOCS_API_TOKEN}', diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 4417a3e..1097d51 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -51,6 +51,7 @@ import ErrorCodes, { OauthErrors } from 'src/utils/errorCodes'; import jwt from 'jsonwebtoken'; import { LanguageEnum } from 'src/utils/languages.enum'; import { Language } from 'src/decorators/language.decorator'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; @ApiTags('Auth') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @@ -90,21 +91,6 @@ export class AuthController { return this.authClient.signIn({ username, password, totp }, metadata); } - @Post('/sso/snowflake') - @RequireAllPermissions(PERMISSIONS_GROUPS.SNOWFLAKE.permissions.OPEN) - @HttpCode(HttpStatus.OK) - async snowflakeSignIn( - @User() user: RequestUser, - @Body('RelayState') relayState: string, - ) { - this.logger.info('/auth - snowflakeSignIn'); - - return this.authClient.snowflakeSignIn({ - userId: user.user_id, - relayState, - }); - } - @Post('refresh-access-token') @HttpCode(HttpStatus.OK) @ApiOkResponse({ type: AuthRefreshAccessTokenRes }) @@ -123,6 +109,23 @@ export class AuthController { return this.authClient.refreshAccessToken({ refreshToken }, metadata); } + @ApiInternalOnlyEndpoint() + @Post('/sso/snowflake') + @RequireAllPermissions(PERMISSIONS_GROUPS.SNOWFLAKE.permissions.OPEN) + @HttpCode(HttpStatus.OK) + async snowflakeSignIn( + @User() user: RequestUser, + @Body('RelayState') relayState: string, + ) { + this.logger.info('/auth - snowflakeSignIn'); + + return this.authClient.snowflakeSignIn({ + userId: user.user_id, + relayState, + }); + } + + @ApiInternalOnlyEndpoint() @Post('change-password') @HttpCode(HttpStatus.OK) async changePassword( @@ -141,6 +144,7 @@ export class AuthController { }); } + @ApiInternalOnlyEndpoint() @Post('reset-password') @HttpCode(HttpStatus.OK) async resetPassword( @@ -157,6 +161,7 @@ export class AuthController { return this.authClient.resetPassword({ username }, metadata); } + @ApiInternalOnlyEndpoint() @Post('verify-reset-password-code') @HttpCode(HttpStatus.OK) async verifyResetPasswordCode( @@ -169,6 +174,7 @@ export class AuthController { return this.authClient.verifyResetPasswordCode({ username, code }); } + @ApiInternalOnlyEndpoint() @Post('confirm-reset-password') @HttpCode(HttpStatus.OK) async confirmResetPassword(@Body() body: AuthConfirmResetPasswordRequest) { @@ -183,6 +189,7 @@ export class AuthController { }); } + @ApiInternalOnlyEndpoint() @Post('enable-totp') @HttpCode(HttpStatus.OK) async enableTotpMFA( @@ -197,6 +204,7 @@ export class AuthController { return this.authClient.enableTotpMFA({ accessToken, password }); } + @ApiInternalOnlyEndpoint() @Post('disable-totp') @HttpCode(HttpStatus.OK) async disableTotpMFA( @@ -211,6 +219,7 @@ export class AuthController { return this.authClient.disableTotpMFA({ accessToken, password }); } + @ApiInternalOnlyEndpoint() @Post('dismiss-totp') @HttpCode(HttpStatus.OK) async dismissTotpMFA(@Headers() headers) { @@ -221,6 +230,7 @@ export class AuthController { return this.authClient.dismissTotpMFA({ accessToken }); } + @ApiInternalOnlyEndpoint() @Post('verify-totp') @HttpCode(HttpStatus.OK) async verifyTotp(@Body() body: AuthVerifyTotpMfaRequest, @Headers() headers) { @@ -232,6 +242,7 @@ export class AuthController { return this.authClient.verifyTotp({ accessToken, totp }); } + @ApiInternalOnlyEndpoint() @Authenticated() @ApiSecurity('access-token') @Get('verify-access-token') @@ -239,11 +250,13 @@ export class AuthController { return { access_token_status: 'valid' }; } + @ApiInternalOnlyEndpoint() @Get('session/:session') getSession(@Param('session') session: string) { return this.authClient.getSession(session); } + @ApiInternalOnlyEndpoint() @Get('oauth/google') @UseGuards(AuthGuard('google-login')) googleOauth() { @@ -251,6 +264,7 @@ export class AuthController { return true; } + @ApiInternalOnlyEndpoint() @Get('oauth/google/callback') @UseGuards(AuthGuard('google-login')) @Redirect() diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 2614b3c..6583726 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -39,6 +39,7 @@ import { import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; import { Language } from 'src/decorators/language.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; @ApiTags('Catalog') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @@ -94,6 +95,7 @@ export class CatalogController { return res; } + @ApiInternalOnlyEndpoint() @Get('data-asset') async findByPipelineAndObject(@User() user: RequestUser, @Query() query) { const { username, user_id, customer_id, customer_name, permissions } = user; @@ -147,6 +149,7 @@ export class CatalogController { ); } + @ApiInternalOnlyEndpoint() @Get('tags') @RequireSomePermission( PERMISSIONS_GROUPS.CATALOG.permissions.GET, @@ -225,6 +228,7 @@ export class CatalogController { return { data_asset }; } + @ApiInternalOnlyEndpoint() @Get('data-asset/rls/:id') @RequireSomePermission( PERMISSIONS_GROUPS.CATALOG.permissions.GET, @@ -433,6 +437,7 @@ export class CatalogController { return res; } + @ApiInternalOnlyEndpoint() @Put('data-asset/:id/manage-permissions') async manageDataAssetPermissions( @Param('id') id: string, @@ -454,6 +459,7 @@ export class CatalogController { return { data_asset: JSON.parse(response.data_asset) }; } + @ApiInternalOnlyEndpoint() @Put('data-asset/:id/revoke-permissions') async revokeDataAssetPermissions( @Param('id') id: string, diff --git a/src/modules/connection/connection.controller.ts b/src/modules/connection/connection.controller.ts index a2245c1..255daba 100644 --- a/src/modules/connection/connection.controller.ts +++ b/src/modules/connection/connection.controller.ts @@ -31,6 +31,7 @@ import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; import { Language } from 'src/decorators/language.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; const connectionPermissions = PERMISSIONS_GROUPS.CONNECTION.permissions; @UseFilters(new GrpcToHttpExceptionFilter()) @@ -47,6 +48,7 @@ export class ConnectionController { this.logger = dadosferaLogger.logger; } + @ApiInternalOnlyEndpoint() @Get('connections-migration') @ApiExcludeEndpoint() @RequireAllPermissions( diff --git a/src/modules/connector/connector.controller.ts b/src/modules/connector/connector.controller.ts index a786912..10c57e4 100644 --- a/src/modules/connector/connector.controller.ts +++ b/src/modules/connector/connector.controller.ts @@ -30,7 +30,9 @@ import { import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; import { Language } from 'src/decorators/language.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('connectors') @Authenticated() @Controller('connectors') diff --git a/src/modules/inputs/inputs.controller.ts b/src/modules/inputs/inputs.controller.ts index d7670bf..0145bc3 100644 --- a/src/modules/inputs/inputs.controller.ts +++ b/src/modules/inputs/inputs.controller.ts @@ -24,6 +24,7 @@ import { UpdateInputRequest } from './dtos/old_interfaces'; import { RequestUser, User } from 'src/decorators/user.decorator'; import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; @ApiTags('Inputs') @Controller('inputs') @@ -66,6 +67,7 @@ export class InputsController { this.logger = dadosferaLogger.logger; } + @ApiInternalOnlyEndpoint() @Get('available-entities/:plugin') @ApiOkResponse({ type: GetAvailableEntitiesRes }) async getAvailableEntities( @@ -102,6 +104,7 @@ export class InputsController { return response; } + @ApiInternalOnlyEndpoint() @Get() async findAll(@User() user: RequestUser) { const { user_id, customer_id, customer_name: customer } = user; @@ -132,6 +135,7 @@ export class InputsController { return response; } + @ApiInternalOnlyEndpoint() @Patch(':id') async update(@Body() updateInputDto: UpdateInputRequest, @Param() params) { const { id } = params; @@ -147,6 +151,7 @@ export class InputsController { return response; } + @ApiInternalOnlyEndpoint() @Delete(':id') async delete(@Body() data, @Param() params) { const { id } = params; diff --git a/src/modules/mixpanel/mixpanel.controller.ts b/src/modules/mixpanel/mixpanel.controller.ts index cb1b641..76f7809 100644 --- a/src/modules/mixpanel/mixpanel.controller.ts +++ b/src/modules/mixpanel/mixpanel.controller.ts @@ -1,8 +1,10 @@ import { Body, Controller, Inject, Param, Post } from '@nestjs/common'; import { init } from 'mixpanel'; import { Authenticated } from 'src/decorators/authentication.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; import { RequestUser, User } from 'src/decorators/user.decorator'; +@ApiInternalOnlyController() @Authenticated() @Controller('trackEvent') export class MixpanelController { diff --git a/src/modules/network-config/network-config-client.config.ts b/src/modules/network-config/network-config-client.config.ts index 09bed03..a5227f8 100644 --- a/src/modules/network-config/network-config-client.config.ts +++ b/src/modules/network-config/network-config-client.config.ts @@ -6,6 +6,8 @@ import { } from '@nestjs/microservices'; import { NetworkConfig } from '@dadosfera/protospack-v2'; +const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0'); + export class NetworkConfigGrpcClient { public name = 'NetworkConfigGrpcClient'; @@ -17,8 +19,7 @@ export class NetworkConfigGrpcClient { NetworkConfig.ProtoPackages.ReadPackage, NetworkConfig.ProtoPackages.WritePackage, ], - credentials: - process.env.ENV === 'local' ? undefined : credentials.createSsl(), + credentials: isLocalConnection ? undefined : credentials.createSsl(), protoPath: [ NetworkConfig.ProtoPaths.ReadFilePath, NetworkConfig.ProtoPaths.WriteFilePath, diff --git a/src/modules/network-config/network-config.controller.ts b/src/modules/network-config/network-config.controller.ts index 26c0df7..1c7552c 100644 --- a/src/modules/network-config/network-config.controller.ts +++ b/src/modules/network-config/network-config.controller.ts @@ -39,6 +39,7 @@ export class NetworkConfigController { ) { this.logger = dadosferaLogger.logger; } + @Get() @ApiOkResponse({ type: FindAllNetworkConfigsRes }) async findAllNetworkConfigs( diff --git a/src/modules/oauth/oauth.controller.ts b/src/modules/oauth/oauth.controller.ts index 2feb441..1e87866 100644 --- a/src/modules/oauth/oauth.controller.ts +++ b/src/modules/oauth/oauth.controller.ts @@ -5,6 +5,7 @@ import { ConnectionClientService } from '../connection/client.service'; import jwt from 'jsonwebtoken'; import DadosferaLogger from '@dadosfera/dadosfera-logs/dist'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; @ApiTags('oauth') @Controller('oauth') export class OauthController { @@ -31,6 +32,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('hubspot/callback') @UseGuards(AuthGuard('hubspot')) @Redirect() @@ -44,6 +46,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('googleads/callback') @UseGuards(AuthGuard('google')) @Redirect() @@ -57,6 +60,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('google-sheets/callback') @UseGuards(AuthGuard('google')) @Redirect() @@ -70,6 +74,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('facebook/callback') @UseGuards(AuthGuard('facebook')) @Redirect() @@ -83,6 +88,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('mailchimp/callback') @UseGuards(AuthGuard('mailchimp')) @Redirect() @@ -96,6 +102,7 @@ export class OauthController { return true; } + @ApiInternalOnlyEndpoint() @Get('salesforce/callback') @UseGuards(AuthGuard('salesforce')) @Redirect() diff --git a/src/modules/permissions/permissions.controller.ts b/src/modules/permissions/permissions.controller.ts index 45b46d0..13494bd 100644 --- a/src/modules/permissions/permissions.controller.ts +++ b/src/modules/permissions/permissions.controller.ts @@ -8,7 +8,9 @@ import { LanguageEnum } from 'src/utils/languages.enum'; import { GetPublicPermissionsRes } from './dto/entities'; import { PermissionsService } from './permissions.service'; import { Language } from 'src/decorators/language.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('Permissions') @Authenticated() @Controller('permissions') diff --git a/src/modules/permissions/permissions.service.ts b/src/modules/permissions/permissions.service.ts index fefb723..9ea6ac8 100644 --- a/src/modules/permissions/permissions.service.ts +++ b/src/modules/permissions/permissions.service.ts @@ -60,7 +60,7 @@ export class PermissionsService }).catch((err: ErrorBuilder) => { if ( err.code === 'No connection established' && - (process.env.LOCAL_ENV === 'true' || process.env.ENV === 'local') + process.env.ENV === 'local' ) { return this.logger.info( "couldn't connect to DUC. suppressing in local env", diff --git a/src/modules/pipelines/pipelines.controller.ts b/src/modules/pipelines/pipelines.controller.ts index ea094b8..0d967a2 100644 --- a/src/modules/pipelines/pipelines.controller.ts +++ b/src/modules/pipelines/pipelines.controller.ts @@ -7,7 +7,9 @@ import { import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { PipelinesService } from './pipelines.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('Pipelines') @Controller('pipelines') @Authenticated() diff --git a/src/modules/pipelinesV2/pipelines.controller.ts b/src/modules/pipelinesV2/pipelines.controller.ts index 66d5e1e..c457f33 100644 --- a/src/modules/pipelinesV2/pipelines.controller.ts +++ b/src/modules/pipelinesV2/pipelines.controller.ts @@ -44,6 +44,7 @@ import { import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; import { LanguageEnum } from 'src/utils/languages.enum'; import { Language } from 'src/decorators/language.decorator'; +import { ApiInternalOnlyEndpoint } from 'src/decorators/swagger.decorator'; @ApiTags('PipelinesV2') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @@ -279,6 +280,7 @@ export class PipelinesController { return response; } + @ApiInternalOnlyEndpoint() @Put('/:id') @ApiOperation({ deprecated: true, @@ -290,9 +292,9 @@ export class PipelinesController { @Param('id') id, @User() user: RequestUser, ) { - this.logger.info('PipelinesController - patch', { user }); + this.logger.info('PipelinesController - put', { user }); const response = await this.update(language, updatePipelineDto, id, user); - this.logger.info('PipelinesController - patch: OK', { user }); + this.logger.info('PipelinesController - put: OK', { user }); return response; } @@ -311,6 +313,7 @@ export class PipelinesController { this.logger.info('PipelinesController - delete: OK'); } + @ApiInternalOnlyEndpoint() @Post('/init-upload') @RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE) async initUploadFile( @@ -342,6 +345,7 @@ export class PipelinesController { return { urls: JSON.parse(urls), upload_id }; } + @ApiInternalOnlyEndpoint() @Post('/complete-upload') @RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE) async completeUploadFile( @@ -359,6 +363,7 @@ export class PipelinesController { ); } + @ApiInternalOnlyEndpoint() @Post('/file') @RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE) async uploadedFile( @@ -401,6 +406,7 @@ export class PipelinesController { return pipeline; } + @ApiInternalOnlyEndpoint() @Post('start/:id') async activate(@Param() params, @Body() body) { const { id } = params; diff --git a/src/modules/productboard/productboard.controller.ts b/src/modules/productboard/productboard.controller.ts index 481b6f1..749b03d 100644 --- a/src/modules/productboard/productboard.controller.ts +++ b/src/modules/productboard/productboard.controller.ts @@ -2,10 +2,12 @@ import { Body, Controller, HttpException, Post } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import axios from 'axios'; import { Authenticated } from 'src/decorators/authentication.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; import { User, RequestUser } from 'src/decorators/user.decorator'; import { getSecretFromSecretsManager } from 'src/utils/SecretManager'; import { INote } from './dtos'; +@ApiInternalOnlyController() @ApiTags('Productboard') @Controller('productboard') @Authenticated() diff --git a/src/modules/roles/roles.controller.ts b/src/modules/roles/roles.controller.ts index f3fa0bb..a595bcf 100644 --- a/src/modules/roles/roles.controller.ts +++ b/src/modules/roles/roles.controller.ts @@ -45,7 +45,9 @@ import { } from 'src/decorators/authentication.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; import { Language } from 'src/decorators/language.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('Roles') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @Authenticated() diff --git a/src/modules/termsOfUse/termsOfUse.controller.ts b/src/modules/termsOfUse/termsOfUse.controller.ts index 7d23139..d2d3fb1 100644 --- a/src/modules/termsOfUse/termsOfUse.controller.ts +++ b/src/modules/termsOfUse/termsOfUse.controller.ts @@ -20,7 +20,9 @@ import { RequestUser, User } from '../../decorators/user.decorator'; import { Metadata } from '@grpc/grpc-js'; import { Language } from 'src/decorators/language.decorator'; import { LanguageEnum } from 'src/utils/languages.enum'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('TermsOfUse') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) @UseFilters(new GrpcToHttpExceptionFilter()) diff --git a/src/modules/transformations/transformations.controller.ts b/src/modules/transformations/transformations.controller.ts index df66c44..4cedddb 100644 --- a/src/modules/transformations/transformations.controller.ts +++ b/src/modules/transformations/transformations.controller.ts @@ -19,7 +19,10 @@ import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum'; import { TransformationsService } from './transformations.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { RequestUser, User } from 'src/decorators/user.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; const pipelinePermissions = PERMISSIONS_GROUPS.PIPELINE.permissions; + +@ApiInternalOnlyController() @ApiTags('Transformations') @Controller('transformations') @Authenticated() diff --git a/src/modules/users/users.controller.ts b/src/modules/users/users.controller.ts index 308d4fd..9e00f7c 100644 --- a/src/modules/users/users.controller.ts +++ b/src/modules/users/users.controller.ts @@ -26,6 +26,7 @@ import { RequireAllPermissions, } from 'src/decorators/authentication.decorator'; import { Language } from 'src/decorators/language.decorator'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; import { RequestUser, User } from 'src/decorators/user.decorator'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; import { PackTheMetadata } from 'src/utils/ PackTheMetadata'; @@ -52,6 +53,7 @@ import { } from './dtos/entities'; import { UsersService } from './users.service'; +@ApiInternalOnlyController() @ApiTags('Users') @Controller('users') @ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }]) From 87882b5afc2777070b4e175b7f9816b99149a436 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Feb 2023 13:14:53 -0300 Subject: [PATCH 11/19] FIX: add multiple servers --- docsfera.external.json | 15 ++++++++++++++- src/main.ts | 27 +++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/docsfera.external.json b/docsfera.external.json index 1fdca24..4804bf0 100644 --- a/docsfera.external.json +++ b/docsfera.external.json @@ -1669,7 +1669,20 @@ "contact": {} }, "tags": [], - "servers": [], + "servers": [ + { + "url": "https://maestro.stg.dadosfera.ai", + "description": "Ambiente STG" + }, + { + "url": "https://maestro-2.stg.dadosfera.ai", + "description": "Ambiente STG2" + }, + { + "url": "https://maestro.dadosfera.ai", + "description": "Ambiente PRD" + } + ], "components": { "securitySchemes": { "access-token": { diff --git a/src/main.ts b/src/main.ts index 12d4b73..f5872cc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,7 +14,7 @@ async function bootstrap() { serviceEnvironment: process.env.ENV, }); const logger = new DadosferaLogger(); - process.env.INTERNAL_SWAGGER = 'true'; + const app = await NestFactory.create(AppModule, { logger, cors: { @@ -24,21 +24,8 @@ async function bootstrap() { optionsSuccessStatus: 204, }, }); - process.env.INTERNAL_SWAGGER = 'true'; - const app2 = await NestFactory.create(AppModule, { - logger, - cors: { - origin: '*', - methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', - preflightContinue: false, - optionsSuccessStatus: 204, - }, - }); - app.use(helmet()); configureSwagger(app); - // configureSwagger(app2); - await app.listen(3333); } @@ -63,14 +50,18 @@ function configureSwagger(app: INestApplication) { in: 'header', }) .setDescription('This is the Maestro API') + .addServer('https://maestro.stg.dadosfera.ai', 'Ambiente STG') + .addServer('https://maestro-2.stg.dadosfera.ai', 'Ambiente STG2') + .addServer('https://maestro.dadosfera.ai', 'Ambiente PRD') .build(); const document = SwaggerModule.createDocument(app, config); - let swaggerJsonFile = 'docsfera.external.json'; - if (process.env.INTERNAL_SWAGGER === 'true') { - swaggerJsonFile = 'docsfera.json'; - } + const swaggerJsonFile = + process.env.INTERNAL_SWAGGER === 'true' + ? 'docsfera.json' + : 'docsfera.external.json'; + if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document); writeFileSync( From b383070b68ecc23e35e1dafb8d01b2c8bde5baaa Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Feb 2023 14:07:26 -0300 Subject: [PATCH 12/19] Internal docs --- docsfera.json | 4098 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 4097 insertions(+), 1 deletion(-) diff --git a/docsfera.json b/docsfera.json index 1fdca24..a4f3757 100644 --- a/docsfera.json +++ b/docsfera.json @@ -93,6 +93,455 @@ ] } }, + "/auth/sso/snowflake": { + "post": { + "operationId": "AuthController_snowflakeSignIn", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/auth/change-password": { + "post": { + "operationId": "AuthController_changePassword", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/reset-password": { + "post": { + "operationId": "AuthController_resetPassword", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/verify-reset-password-code": { + "post": { + "operationId": "AuthController_verifyResetPasswordCode", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/confirm-reset-password": { + "post": { + "operationId": "AuthController_confirmResetPassword", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/enable-totp": { + "post": { + "operationId": "AuthController_enableTotpMFA", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/disable-totp": { + "post": { + "operationId": "AuthController_disableTotpMFA", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/dismiss-totp": { + "post": { + "operationId": "AuthController_dismissTotpMFA", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/verify-totp": { + "post": { + "operationId": "AuthController_verifyTotp", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/verify-access-token": { + "get": { + "operationId": "AuthController_verifyAccessToken", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Auth" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/auth/session/{session}": { + "get": { + "operationId": "AuthController_getSession", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "session", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/oauth/google": { + "get": { + "operationId": "AuthController_googleOauth", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "boolean" + } + } + } + } + }, + "tags": [ + "Auth" + ] + } + }, + "/auth/oauth/google/callback": { + "get": { + "operationId": "AuthController_googleOauthCallback", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Auth" + ] + } + }, "/connections": { "post": { "operationId": "ConnectionController_createConnection", @@ -264,6 +713,1630 @@ ] } }, + "/users": { + "get": { + "operationId": "UsersController_getAllUsersByCustomerId", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAllUsersByCustomerIdRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "post": { + "operationId": "UsersController_createUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserReq" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/hierarchies": { + "get": { + "operationId": "UsersController_getAllHierarchies", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAllHierarchiesRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/departments": { + "get": { + "operationId": "UsersController_getAllDepartments", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAllDepartmentsRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/jobTitles": { + "get": { + "operationId": "UsersController_getAllJobTitles", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAllDepartmentsRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/{id}": { + "get": { + "operationId": "UsersController_findOneById", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IUserByCustomer" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "UsersController_deleteUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeleteUserRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "patch": { + "operationId": "UsersController_updateUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateUserReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateUserRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/batch": { + "post": { + "operationId": "UsersController_batchCreateUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchCreateUserReq" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BatchCreateUserRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/{id}/resend-invite": { + "post": { + "operationId": "UsersController_resendInvite", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/role": { + "delete": { + "operationId": "UsersController_unassignRoleToUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "userId", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "roleId", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "put": { + "operationId": "UsersController_assignRoleToUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssignRoleToUserReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/roles": { + "patch": { + "operationId": "UsersController_setUserRoles", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetUserRolesReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetUserRolesRes" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/users/synchronize/{id}": { + "post": { + "operationId": "UsersController_synchronizeUser", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateUserRes" + } + } + } + }, + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Users" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/roles": { + "get": { + "operationId": "RolesController_searchRoles", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "permissionId", + "required": false, + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "getUsers", + "required": false, + "in": "query", + "schema": { + "enum": [ + "true", + "false" + ], + "type": "string" + } + }, + { + "name": "canUntoggleLogic", + "required": false, + "in": "query", + "schema": { + "enum": [ + "data_assets_sharing" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetRolesByCustomerRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "post": { + "operationId": "RolesController_createRole", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRoleReq" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRoleRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/roles/permissions": { + "put": { + "operationId": "RolesController_grantPermissionsToRole", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GrantPermissionsToRoleReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GrantPermissionsToRoleRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "RolesController_revokePermissionsFromRole", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevokePermissionsFromRoleReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RevokePermissionsFromRoleRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "patch": { + "operationId": "RolesController_setRolePermissions", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetRolePermissionsReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetRolePermissionsRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/roles/users": { + "patch": { + "operationId": "RolesController_setRoleUsers", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetRoleUsersReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SetRoleUsersRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/roles/{id}": { + "get": { + "operationId": "RolesController_getRoleById", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleDto" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "RolesController_deleteRole", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "patch": { + "operationId": "RolesController_updateRole", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateRoleReq" + } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateRoleRes" + } + } + } + } + }, + "tags": [ + "Roles" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/permissions": { + "get": { + "operationId": "PermissionsController_getPublicPermissions", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "description": "Defaults to pt-br", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetPublicPermissionsRes" + } + } + } + } + }, + "tags": [ + "Permissions" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/connectors": { + "post": { + "operationId": "ConnectorController_uploadConnector", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/CreateConnectorDto" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "get": { + "operationId": "ConnectorController_getAllConnectors", + "parameters": [ + { + "name": "search", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "language", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "size", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "page", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/uploads": { + "post": { + "operationId": "ConnectorController_uploadFile", + "parameters": [], + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object" + } + } + } + } + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/multiple-connectors-upload": { + "post": { + "operationId": "ConnectorController_uploadConnectorsFile", + "parameters": [], + "responses": { + "201": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/tags": { + "get": { + "operationId": "ConnectorController_getConnectorsTags", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/{plugin}": { + "get": { + "operationId": "ConnectorController_getConnector", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + }, + { + "name": "version", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "put": { + "operationId": "ConnectorController_updateConnector", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/UpdateDto" + } + } + } + }, + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "ConnectorController_deleteConnector", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + }, + { + "name": "version", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/{plugin}/details": { + "get": { + "operationId": "ConnectorController_getConnectorDetails", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + }, + { + "name": "version", + "required": true, + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/{plugin}/add-tag": { + "put": { + "operationId": "ConnectorController_addTagOnConnector", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddTagDto" + } + } + } + }, + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/connectors/{plugin}/remove-tag": { + "put": { + "operationId": "ConnectorController_removeTagOnConnector", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RemoveTagDto" + } + } + } + }, + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "connectors" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, "/network-config": { "get": { "operationId": "NetworkConfigController_findAllNetworkConfigs", @@ -407,6 +2480,41 @@ ] } }, + "/inputs/available-entities/{plugin}": { + "get": { + "operationId": "InputsController_getAvailableEntities", + "parameters": [ + { + "name": "plugin", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetAvailableEntitiesRes" + } + } + } + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, "/inputs": { "post": { "operationId": "InputsController_create", @@ -444,6 +2552,23 @@ "access-token": [] } ] + }, + "get": { + "operationId": "InputsController_findAll", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] } }, "/inputs/{id}": { @@ -470,6 +2595,54 @@ "access-token": [] } ] + }, + "patch": { + "operationId": "InputsController_update", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "InputsController_delete", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Inputs" + ], + "security": [ + { + "access-token": [] + } + ] } }, "/pipelinesV2": { @@ -769,6 +2942,46 @@ } ] }, + "put": { + "operationId": "PipelinesController_updateDeprecated", + "summary": "", + "deprecated": true, + "description": "This method is deprecated. Please use PATCH instead", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + }, "delete": { "operationId": "PipelinesController_delete", "parameters": [ @@ -800,6 +3013,392 @@ ] } }, + "/pipelinesV2/init-upload": { + "post": { + "operationId": "PipelinesController_initUploadFile", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/IInitUploadCSVFile" + } + } + } + }, + "responses": { + "201": { + "description": "" + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/complete-upload": { + "post": { + "operationId": "PipelinesController_completeUploadFile", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ICompleteUploadCSVFile" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/file": { + "post": { + "operationId": "PipelinesController_uploadedFile", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ICreatePipelineCSVFile" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/pipelinesV2/start/{id}": { + "post": { + "operationId": "PipelinesController_activate", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "PipelinesV2" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/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": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Pipelines" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/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": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Pipelines" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/transformations": { + "post": { + "operationId": "TransformationsController_create", + "parameters": [], + "responses": { + "201": { + "description": "" + } + }, + "tags": [ + "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "get": { + "operationId": "TransformationsController_findAll", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, + "/transformations/{id}": { + "get": { + "operationId": "TransformationsController_findOne", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "put": { + "operationId": "TransformationsController_update", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + }, + "delete": { + "operationId": "TransformationsController_delete", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Transformations" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, "/catalog": { "get": { "operationId": "CatalogController_searchCatalog", @@ -908,6 +3507,80 @@ ] } }, + "/catalog/data-asset": { + "get": { + "operationId": "CatalogController_findByPipelineAndObject", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/catalog/tags": { + "get": { + "operationId": "CatalogController_findAllTags", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, "/catalog/data-asset/{id}": { "get": { "operationId": "CatalogController_getDataAsset", @@ -1049,6 +3722,41 @@ ] } }, + "/catalog/data-asset/rls/{id}": { + "get": { + "operationId": "CatalogController_getDataAssetRls", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + }, + { + "access-token": [] + } + ] + } + }, "/catalog/data-asset/{id}/columns-metadata": { "get": { "operationId": "CatalogController_getDataAssetColumnsMetadata", @@ -1223,6 +3931,86 @@ ] } }, + "/catalog/data-asset/{id}/manage-permissions": { + "put": { + "operationId": "CatalogController_manageDataAssetPermissions", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/catalog/data-asset/{id}/revoke-permissions": { + "put": { + "operationId": "CatalogController_revokeDataAssetPermissions", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Catalog" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, "/catalog/data-asset/{id}/comment": { "post": { "operationId": "CatalogController_commentOnDataAsset", @@ -1341,6 +4129,74 @@ ] } }, + "/terms-of-use/token": { + "get": { + "operationId": "TermsOfUseController_getToken", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "TermsOfUse" + ] + } + }, + "/terms-of-use/accept": { + "post": { + "operationId": "TermsOfUseController_accept", + "parameters": [ + { + "name": "dadosfera-lang", + "in": "header", + "required": false, + "schema": { + "enum": [ + "pt-br", + "en-us" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "TermsOfUse" + ] + } + }, "/connection-test/ping": { "post": { "operationId": "ConnectionTestController_connectionTestPing", @@ -1542,6 +4398,20 @@ ] } }, + "/oauth/hubspot/callback": { + "get": { + "operationId": "OauthController_oauthHubspotCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, "/oauth/googleads": { "get": { "operationId": "OauthController_oauthGoogleAds", @@ -1563,6 +4433,20 @@ ] } }, + "/oauth/googleads/callback": { + "get": { + "operationId": "OauthController_oauthGoogleAdsCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, "/oauth/google-sheets": { "get": { "operationId": "OauthController_oauthGoogleSheets", @@ -1584,6 +4468,20 @@ ] } }, + "/oauth/google-sheets/callback": { + "get": { + "operationId": "OauthController_oauthGoogleSheetsCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, "/oauth/facebook": { "get": { "operationId": "OauthController_oauthFacebook", @@ -1605,6 +4503,20 @@ ] } }, + "/oauth/facebook/callback": { + "get": { + "operationId": "OauthController_oauthFacebookCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, "/oauth/mailchimp": { "get": { "operationId": "OauthController_oauthMailchimp", @@ -1626,6 +4538,20 @@ ] } }, + "/oauth/mailchimp/callback": { + "get": { + "operationId": "OauthController_oauthMailchimpCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, "/oauth/salesforce": { "get": { "operationId": "OauthController_oauthSalesforce", @@ -1647,6 +4573,72 @@ ] } }, + "/oauth/salesforce/callback": { + "get": { + "operationId": "OauthController_oauthSalesforceCallback", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "oauth" + ] + } + }, + "/productboard/notes": { + "post": { + "operationId": "ProductboardController_sendNote", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/INote" + } + } + } + }, + "responses": { + "201": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + }, + "tags": [ + "Productboard" + ], + "security": [ + { + "access-token": [] + } + ] + } + }, + "/trackEvent/{id}": { + "post": { + "operationId": "MixpanelController_trackEvent", + "parameters": [], + "responses": { + "201": { + "description": "" + } + }, + "security": [ + { + "access-token": [] + } + ] + } + }, "/health": { "get": { "operationId": "HealthController_check", @@ -1669,7 +4661,20 @@ "contact": {} }, "tags": [], - "servers": [], + "servers": [ + { + "url": "https://maestro.stg.dadosfera.ai", + "description": "Ambiente STG" + }, + { + "url": "https://maestro-2.stg.dadosfera.ai", + "description": "Ambiente STG2" + }, + { + "url": "https://maestro.dadosfera.ai", + "description": "Ambiente PRD" + } + ], "components": { "securitySchemes": { "access-token": { @@ -2107,6 +5112,975 @@ "message" ] }, + "PermissionDto": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "seqid": { + "type": "number" + }, + "name": { + "type": "string" + }, + "claim": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "seqid", + "name", + "claim", + "createdAt", + "updatedAt" + ] + }, + "Customer": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "tier": { + "type": "string" + }, + "info": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "domain", + "tier", + "info", + "createdAt", + "updatedAt" + ] + }, + "UserRole": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionDto" + } + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "isPublic": { + "type": "boolean" + }, + "customer": { + "$ref": "#/components/schemas/Customer" + }, + "usage": { + "type": "string" + }, + "canUntoggle": { + "type": "boolean", + "description": "Whether this role can be untoggled" + } + }, + "required": [ + "id", + "name", + "description", + "createdAt", + "updatedAt", + "isPublic", + "customer", + "usage" + ] + }, + "IUserByCustomer": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserRole" + } + }, + "jobTitle": { + "type": "string" + }, + "department": { + "type": "string" + }, + "hierarchy": { + "type": "string" + }, + "mfaStatus": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "status": { + "type": "string" + }, + "lastLogin": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "id", + "name", + "email", + "roles", + "jobTitle", + "department", + "hierarchy", + "mfaStatus", + "createdAt", + "updatedAt", + "status" + ] + }, + "GetAllUsersByCustomerIdRes": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IUserByCustomer" + } + }, + "departments": { + "type": "array", + "items": { + "type": "string" + } + }, + "jobTitles": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "users", + "departments", + "jobTitles" + ] + }, + "Hierarchy": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "GetAllHierarchiesRes": { + "type": "object", + "properties": { + "hierarchies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Hierarchy" + } + } + }, + "required": [ + "hierarchies" + ] + }, + "GetAllDepartmentsRes": { + "type": "object", + "properties": { + "departments": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "departments" + ] + }, + "CreateUserReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "roleNames": { + "type": "array", + "items": { + "type": "string" + } + }, + "jobTitle": { + "type": "string" + }, + "department": { + "type": "string" + }, + "hierarchy": { + "type": "string" + } + }, + "required": [ + "email" + ] + }, + "User": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserRole" + } + }, + "jobTitle": { + "type": "string" + }, + "department": { + "type": "string" + }, + "hierarchy": { + "type": "string" + }, + "customer": { + "$ref": "#/components/schemas/Customer" + }, + "mfaStatus": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "status": { + "type": "string" + }, + "lastLogin": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "email", + "roles", + "jobTitle", + "department", + "hierarchy", + "mfaStatus", + "createdAt", + "updatedAt", + "status" + ] + }, + "CreateUserRes": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/User" + } + }, + "required": [ + "user" + ] + }, + "BatchCreateUserReq": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CreateUserReq" + } + } + }, + "required": [ + "users" + ] + }, + "ErrorUsers": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/CreateUserReq" + }, + "error": { + "type": "string" + } + }, + "required": [ + "user", + "error" + ] + }, + "BatchCreateUserRes": { + "type": "object", + "properties": { + "usersCreated": { + "type": "array", + "items": { + "$ref": "#/components/schemas/User" + } + }, + "errorUsers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorUsers" + } + } + }, + "required": [ + "usersCreated", + "errorUsers" + ] + }, + "DeleteUserRes": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "SetUserRolesReq": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "roleNames": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "userId", + "roleNames" + ] + }, + "SetUserRolesRes": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/IUserByCustomer" + } + }, + "required": [ + "user" + ] + }, + "AssignRoleToUserReq": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "roleId": { + "type": "string" + } + }, + "required": [ + "userId", + "roleId" + ] + }, + "UpdateUserReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "jobTitle": { + "type": "string" + }, + "department": { + "type": "string" + }, + "hierarchy": { + "type": "string" + }, + "roleNames": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "UpdateUserRes": { + "type": "object", + "properties": { + "user": { + "$ref": "#/components/schemas/IUserByCustomer" + } + }, + "required": [ + "user" + ] + }, + "UserNoRolesAndCustomer": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "jobTitle": { + "type": "string" + }, + "department": { + "type": "string" + }, + "hierarchy": { + "type": "string" + }, + "mfaStatus": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "status": { + "type": "string" + }, + "lastLogin": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "email", + "jobTitle", + "department", + "hierarchy", + "mfaStatus", + "createdAt", + "updatedAt", + "status" + ] + }, + "RoleDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionDto" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserNoRolesAndCustomer" + } + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "isPublic": { + "type": "boolean" + }, + "customer": { + "$ref": "#/components/schemas/Customer" + }, + "usage": { + "type": "string" + }, + "canUntoggle": { + "type": "boolean", + "description": "Whether this role can be untoggled" + } + }, + "required": [ + "id", + "name", + "description", + "createdAt", + "updatedAt", + "isPublic", + "customer", + "usage" + ] + }, + "GetRolesByCustomerRes": { + "type": "object", + "properties": { + "roles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleDto" + } + } + }, + "required": [ + "roles" + ] + }, + "CreateRoleReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "permissionIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "userIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + } + }, + "required": [ + "name", + "permissionIds", + "description" + ] + }, + "CustomerRole": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionDto" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserNoRolesAndCustomer" + } + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "isPublic": { + "type": "boolean" + }, + "usage": { + "type": "string" + }, + "canUntoggle": { + "type": "boolean", + "description": "Whether this role can be untoggled" + } + }, + "required": [ + "id", + "name", + "description", + "createdAt", + "updatedAt", + "isPublic", + "usage" + ] + }, + "CreateRoleRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/CustomerRole" + } + }, + "required": [ + "role" + ] + }, + "GrantPermissionsToRoleReq": { + "type": "object", + "properties": { + "roleId": { + "type": "string" + }, + "permissionIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "roleId", + "permissionIds" + ] + }, + "GrantPermissionsToRoleRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleDto" + } + }, + "required": [ + "role" + ] + }, + "RevokePermissionsFromRoleReq": { + "type": "object", + "properties": { + "roleId": { + "type": "string" + }, + "permissionIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "roleId", + "permissionIds" + ] + }, + "RevokePermissionsFromRoleRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleDto" + } + }, + "required": [ + "role" + ] + }, + "SetRolePermissionsReq": { + "type": "object", + "properties": { + "roleId": { + "type": "string" + }, + "permissionIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "roleId", + "permissionIds" + ] + }, + "SetRolePermissionsRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleDto" + } + }, + "required": [ + "role" + ] + }, + "SetRoleUsersReq": { + "type": "object", + "properties": { + "roleId": { + "type": "string" + }, + "userIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "roleId", + "userIds" + ] + }, + "SetRoleUsersRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleDto" + } + }, + "required": [ + "role" + ] + }, + "UpdateRoleReq": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + } + }, + "UpdateRoleRes": { + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleDto" + } + }, + "required": [ + "role" + ] + }, + "PermissionGroupPermission": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "id": { + "type": "number" + } + }, + "required": [ + "name", + "id" + ] + }, + "PermissionGroup": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionGroupPermission" + } + } + }, + "required": [ + "title", + "permissions" + ] + }, + "GetPublicPermissionsRes": { + "type": "object", + "properties": { + "permissionGroups": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PermissionGroup" + } + } + }, + "required": [ + "permissionGroups" + ] + }, + "CreateConnectorDto": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "connector": { + "type": "string" + } + }, + "required": [ + "file", + "connector" + ] + }, + "UpdateDto": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "version": { + "type": "string" + }, + "category": { + "type": "string" + }, + "plugin": { + "type": "string" + }, + "image": { + "type": "string" + }, + "docs": { + "type": "string" + }, + "name": { + "type": "string" + }, + "options": { + "type": "object", + "description": "skip_select_entities: boolean skip_select_columns: boolean;" + }, + "connection_controls": { + "type": "array", + "items": { + "properties": {} + } + } + }, + "required": [ + "version" + ] + }, + "AddTagDto": { + "type": "object", + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "tags" + ] + }, + "RemoveTagDto": { + "type": "object", + "properties": { + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "tags" + ] + }, "NetworkConfigToCatalogDto": { "type": "object", "properties": { @@ -2211,6 +6185,38 @@ "network_config" ] }, + "AvailableEntity": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "replication_methods": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "replication_methods" + ] + }, + "GetAvailableEntitiesRes": { + "type": "object", + "properties": { + "entities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AvailableEntity" + } + } + }, + "required": [ + "entities" + ] + }, "TableColumns": { "type": "object", "properties": { @@ -2436,6 +6442,74 @@ "updated_at" ] }, + "IInitUploadCSVFile": { + "type": "object", + "properties": { + "file_name": { + "type": "string" + }, + "parts": { + "type": "number" + } + }, + "required": [ + "file_name", + "parts" + ] + }, + "ICompleteUploadCSVFile": { + "type": "object", + "properties": { + "upload_id": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "parts": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "upload_id", + "file_name", + "parts" + ] + }, + "ICreatePipelineCSVFile": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "file_name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "encoding": { + "type": "string" + }, + "sep": { + "type": "string" + }, + "header": { + "type": "boolean" + } + }, + "required": [ + "name", + "file_name", + "description", + "encoding", + "sep", + "header" + ] + }, "IRole": { "type": "object", "properties": { @@ -3220,6 +7294,28 @@ "operation_result", "tables_metadata" ] + }, + "INote": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "content": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "title", + "content", + "tags" + ] } } } From b8ea729a33d3370b39ecdf859606118a22bb49af Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Feb 2023 14:16:28 -0300 Subject: [PATCH 13/19] FIX: add external docs to docsfera --- .github/workflows/deploy-manually.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index 3c8b624..df0718a 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -187,3 +187,20 @@ jobs: sed -i -e "s/\${DOCS_PAGE_ID}/$DOCS_PAGE_ID/g" docsfera.json sed -i -e "s/\${DOCS_BLOCK_ID}/$DOCS_BLOCK_ID/g" docsfera.json curl -X POST -H 'Content-Type: application/json' -d @docsfera.json $DOCS_URL + + - name: Generate External API docs + env: + DOCS_URL: ${{ secrets.DOCS_URL }} + DOCS_API_TOKEN: ${{ secrets.DOCS_API_TOKEN }} + DOCS_PAGE_ID: ${{secrets.EXTERNAL_DOCS_PAGE_ID}} + DOCS_BLOCK_ID: ${{secrets.EXTERNAL_DOCS_BLOCK_ID}} + EVENT: ${{ github.event_name }} + RELEASE_VERSION: ${{ needs.semantic_release.outputs.new_release_version }} + run: | + if [ ${EVENT} != "workflow_dispatch" ]; then + sed -i -E "s/(\"title\": )\"Maestro.+\"/\1\"Maestro - $RELEASE_VERSION\"/g" docsfera.external.json + fi + sed -i -e "s/\${DOCS_API_TOKEN}/$DOCS_API_TOKEN/g" docsfera.external.json + sed -i -e "s/\${DOCS_PAGE_ID}/$DOCS_PAGE_ID/g" docsfera.external.json + sed -i -e "s/\${DOCS_BLOCK_ID}/$DOCS_BLOCK_ID/g" docsfera.external.json + curl -X POST -H 'Content-Type: application/json' -d @docsfera.external.json $DOCS_URL From 28578d3aa823354e1ab7c83d8a9ea63f32f15c7a Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Feb 2023 16:46:32 -0300 Subject: [PATCH 14/19] FIX: better query params on catalog get all --- docsfera.external.json | 25 +++++++++++++++++++++++-- src/modules/catalog/dtos/index.ts | 27 +++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/docsfera.external.json b/docsfera.external.json index 4804bf0..2251d18 100644 --- a/docsfera.external.json +++ b/docsfera.external.json @@ -816,11 +816,32 @@ "type": "string" } }, + { + "name": "size", + "required": false, + "in": "query", + "description": "Número de registros a ser retornado", + "schema": { + "minimum": 1, + "maximum": 10000, + "type": "number" + } + }, + { + "name": "page", + "required": false, + "in": "query", + "description": "Usado para paginação, em conjunto com `size`", + "schema": { + "minimum": 1, + "type": "number" + } + }, { "name": "sort_by", "required": false, "in": "query", - "description": "Data Asset field to sort", + "description": "Campo do data asset para usar na ordenação. Padrão: `created_at`", "schema": { "type": "string" } @@ -829,7 +850,7 @@ "name": "order", "required": false, "in": "query", - "description": "Tipo de ordenação - asc: crescente; desc: decrescente ", + "description": "Tipo de ordenação - `asc`: crescente; `desc`: decrescente ", "schema": { "default": "asc", "enum": [ diff --git a/src/modules/catalog/dtos/index.ts b/src/modules/catalog/dtos/index.ts index 129cbd7..ffccab0 100644 --- a/src/modules/catalog/dtos/index.ts +++ b/src/modules/catalog/dtos/index.ts @@ -117,15 +117,34 @@ export class IDeleteComment { } export class ICatalogAllRequest { + @ApiPropertyOptional({ + description: 'Texto usado para filtrar os ativos no catálogo.', + }) search; - page: string; - size: string; - @ApiPropertyOptional({ description: 'Data Asset field to sort' }) + + @ApiPropertyOptional({ + description: 'Número de registros a ser retornado', + maximum: 10000, + minimum: 1, + }) + size: number; + + @ApiPropertyOptional({ + description: 'Usado para paginação, em conjunto com `size`', + minimum: 1, + }) + page: number; + + @ApiPropertyOptional({ + description: + 'Campo do data asset para usar na ordenação. Padrão: `created_at`', + }) sort_by: string; + @ApiPropertyOptional({ enum: OrderEnum, default: OrderEnum.asc, - description: 'Tipo de ordenação - asc: crescente; desc: decrescente ', + description: 'Tipo de ordenação - `asc`: crescente; `desc`: decrescente ', }) order?: OrderEnum; } From a4ff07a285f8be1de57c56f1f7fe27ad8f7c2f5f Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Thu, 16 Feb 2023 12:07:47 -0300 Subject: [PATCH 15/19] FIX: removed connection test from external docs --- docsfera.external.json | 454 +----------------- package.json | 1 + src/main.ts | 1 + src/modules/catalog/dtos/index.ts | 2 +- .../connection-test.controller.ts | 2 + 5 files changed, 6 insertions(+), 454 deletions(-) diff --git a/docsfera.external.json b/docsfera.external.json index 2251d18..d850da3 100644 --- a/docsfera.external.json +++ b/docsfera.external.json @@ -841,7 +841,7 @@ "name": "sort_by", "required": false, "in": "query", - "description": "Campo do data asset para usar na ordenação. Padrão: `created_at`", + "description": "Campo do data asset para usar na ordenação. Padrão: `created_at` ", "schema": { "type": "string" } @@ -1362,186 +1362,6 @@ ] } }, - "/connection-test/ping": { - "post": { - "operationId": "ConnectionTestController_connectionTestPing", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestPingReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestPingRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/credentials": { - "post": { - "operationId": "ConnectionTestController_connectionTestCredentials", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestCredentialsReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestCredentialsRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/schemas": { - "post": { - "operationId": "ConnectionTestController_connectionTestListSchemas", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListSchemasReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListSchemasRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/tables": { - "post": { - "operationId": "ConnectionTestController_connectionTestListTables", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListTablesReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConnectionTestListTablesRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, - "/connection-test/table-metadata": { - "post": { - "operationId": "ConnectionTestController_getTableMetadata", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetTableMetadataReq" - } - } - } - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetTableMetadataRes" - } - } - } - } - }, - "tags": [ - "Connection Test" - ], - "security": [ - { - "access-token": [] - } - ] - } - }, "/oauth/hubspot": { "get": { "operationId": "OauthController_oauthHubspot", @@ -2982,278 +2802,6 @@ "required": [ "comment" ] - }, - "ConnectionTestPingReq": { - "type": "object", - "properties": { - "plugin": { - "type": "string" - }, - "host": { - "type": "string" - }, - "port": { - "type": "number" - }, - "network_config_id": { - "type": "string" - }, - "connection_id": { - "type": "string" - } - } - }, - "ConnectionTestPingRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - } - }, - "required": [ - "operation_result" - ] - }, - "ConnectionTestCredentialsProperties": { - "type": "object", - "properties": { - "host": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "password": { - "type": "string" - }, - "database": { - "type": "string" - } - }, - "required": [ - "host", - "port", - "username", - "password", - "database" - ] - }, - "ConnectionTestCredentialsReq": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "type": { - "type": "string" - }, - "network_config_id": { - "type": "string" - }, - "connector_id": { - "type": "string" - }, - "connector_name": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "image_url": { - "type": "string" - }, - "properties": { - "$ref": "#/components/schemas/ConnectionTestCredentialsProperties" - }, - "connection_id": { - "type": "string" - } - }, - "required": [ - "name", - "description", - "type", - "connector_id", - "connector_name", - "plugin", - "image_url", - "properties" - ] - }, - "ConnectionTestCredentialsRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "connection_id": { - "type": "string" - } - }, - "required": [ - "operation_result", - "connection_id" - ] - }, - "ConnectionTestListSchemasReq": { - "type": "object", - "properties": { - "plugin": { - "type": "string" - }, - "connection_id": { - "type": "string" - } - }, - "required": [ - "plugin", - "connection_id" - ] - }, - "ConnectionTestListSchemasRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "schema_list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "operation_result", - "schema_list" - ] - }, - "ConnectionTestListTablesReq": { - "type": "object", - "properties": { - "plugin": { - "type": "string" - }, - "connection_id": { - "type": "string" - }, - "schema": { - "type": "string" - } - }, - "required": [ - "plugin", - "connection_id", - "schema" - ] - }, - "ConnectionTestListTablesRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "table_list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "operation_result", - "table_list" - ] - }, - "GetTableMetadataReq": { - "type": "object", - "properties": { - "connection_id": { - "type": "string" - }, - "plugin": { - "type": "string" - }, - "schema": { - "type": "string" - }, - "table_list": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "connection_id", - "plugin", - "schema", - "table_list" - ] - }, - "ColumnDto": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - } - }, - "required": [ - "name", - "type" - ] - }, - "TableMetadataDto": { - "type": "object", - "properties": { - "table_name": { - "type": "string" - }, - "columns": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ColumnDto" - } - }, - "references": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ColumnDto" - } - } - }, - "required": [ - "table_name", - "columns", - "references" - ] - }, - "GetTableMetadataRes": { - "type": "object", - "properties": { - "operation_result": { - "type": "boolean" - }, - "tables_metadata": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TableMetadataDto" - } - } - }, - "required": [ - "operation_result", - "tables_metadata" - ] } } } diff --git a/package.json b/package.json index 4eaa62a..84e105f 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "start": "nest start", "start:dev": "nest start --watch", "start:debug": "nest start --debug --watch", + "start:kill": "export KILL_AFTER_START=1 && nest start && export KILL_AFTER_START=0", "start:prod": "npm run build && node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", diff --git a/src/main.ts b/src/main.ts index f5872cc..728022b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,6 +27,7 @@ async function bootstrap() { app.use(helmet()); configureSwagger(app); await app.listen(3333); + if (process.env.KILL_AFTER_START) await app.close(); } function configureSwagger(app: INestApplication) { diff --git a/src/modules/catalog/dtos/index.ts b/src/modules/catalog/dtos/index.ts index ffccab0..3d29575 100644 --- a/src/modules/catalog/dtos/index.ts +++ b/src/modules/catalog/dtos/index.ts @@ -137,7 +137,7 @@ export class ICatalogAllRequest { @ApiPropertyOptional({ description: - 'Campo do data asset para usar na ordenação. Padrão: `created_at`', + 'Campo do data asset para usar na ordenação. Padrão: `created_at` ', }) sort_by: string; diff --git a/src/modules/connection-test/connection-test.controller.ts b/src/modules/connection-test/connection-test.controller.ts index cc5c6c8..f197358 100644 --- a/src/modules/connection-test/connection-test.controller.ts +++ b/src/modules/connection-test/connection-test.controller.ts @@ -26,7 +26,9 @@ import { import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { Authenticated } from 'src/decorators/authentication.decorator'; import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter'; +import { ApiInternalOnlyController } from 'src/decorators/swagger.decorator'; +@ApiInternalOnlyController() @ApiTags('Connection Test') @Controller('connection-test') @UseFilters(new GrpcToHttpExceptionFilter()) From 544d13fac55768cdb4c60a4d45b20eff22d773e5 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Thu, 16 Feb 2023 17:01:49 -0300 Subject: [PATCH 16/19] FIX: readme improved --- README.md | 191 +++++++++++++++++++++++++++++++------------------- docsfera.json | 25 ++++++- package.json | 10 +-- 3 files changed, 148 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index ccb4f5b..f5ed2ae 100644 --- a/README.md +++ b/README.md @@ -1,67 +1,98 @@

-

+

# Maestro + Maestro is the Dadosfera's gateway, it's responsible for the communication between the frontend application and Dadosfera's microservices. ## 🚀 Starting + These instructions will allow you to get a working copy of the project on your local machine for development and testing purposes. ### 📋 Requirements + - [NodeJS v18.3.0 LTS / NPM v8.11](https://nodejs.org/pt-br/download/) (you can opt to use [NVM](https://github.com/nvm-sh/nvm) to easily manage node versions) - Request access to AWS Console dev account for **all services** (avoid gradually asking for each needed service. it will slow down your development cycle) - - Create your Access Key on the "Security credentials" menu - - Set the Access Key on your local development machine + - Create your Access Key on the "Security credentials" menu + - Set the Access Key on your local development machine - Request access to the dev, stg and prd VPNs ### 🔧 Installation -- Clone the repository - - SSH - ``` - git clone git@github.com:dadosfera/maestro.git - ``` - or - - HTTPS - ``` - git clone https://github.com/dadosfera/maestro.git - ``` +- Clone the repository + + - SSH + + ``` + git clone git@github.com:dadosfera/maestro.git + ``` + + or + + - HTTPS + ``` + git clone https://github.com/dadosfera/maestro.git + ``` - Select the correct node version (optional, only if using [NVM](https://github.com/nvm-sh/nvm)): - ```sh - nvm use - ``` + + ```sh + nvm use + ``` - Install the project dependencies: - ```sh - npm i - ``` + + ```sh + npm i + ``` - Setup the following enviroment variables: - ``` - ENV= - DUC_URL= - INFACTORY_URL= - OTFACTORY_URL= - PIFACTORY_URL= - SM_OAUTH_PATH= - ``` + + ``` + ENV= + DUC_URL= + INFACTORY_URL= + OTFACTORY_URL= + PIFACTORY_URL= + SM_OAUTH_PATH= + ``` - Start the server: - ```sh - # dev mode - npm run start:dev - # or in debug mode - npm run start:debug - ``` - The service should start successfully. + ```sh + # dev mode + npm run start:dev + + # or in debug mode + npm run start:debug + ``` + + The service should start successfully. + +## 📄 Documentation + +NestJs makes it easy to document each route using decorators on all requests and responses properties. It automatically generates a swagger for given information and provides a route to access it http://localhost:3333/api. +For more info check the [official documentation](https://docs.nestjs.com/openapi/introduction). + +### - Multiple documentations + +We are currently generating **2 different** documentations: Internal and External. + +All routes that have the decorator `@ApiInternalOnly()` will not be visible on the **External** API swagger. + +- When you start the application with `npm run start` it will serve and generate the swagger JSON of the **External** API +- When you start the application with `npm run start:internal` it will serve and generate the swagger JSON of the **Internal** API +- When you run `npm run docs` it will generate the swagger JSON of both **Internal** and **External** API, and save them to `docsfera.json` and `docsfera.external.json` respectively; + +It is important to run `npm run docs` before every deploy so we can always have the most updated docs published. ## Authentication decorators + Maestro have utilities to ease the user authentication on every controller and route. The following decorators are available: ### `@Authenticated` + If the user must be authenticated to make request, we can use the `@Authenticated` decorator in the controller or route, as needed. ```ts @@ -106,6 +137,7 @@ class FooController { ``` ### `@RequireAllPermissions` + This decorator requires that **all permissions** listed are granted to the requesting user. ```ts @@ -125,6 +157,7 @@ class FooController { ``` ### `@RequireSomePermission` + In the following case, the user is required to have **at least one** listed permission. ```ts @@ -144,9 +177,11 @@ class FooController { ``` ### `@AuthenticateCondition` + If a more complicated authentication check needs to be done, we can use the `@AuthenticateCondition` decorator to define it. The custom function must return `true` to authenticate the request. In the following example: + - all routes on the `FooController` controller can only be requested from localhost - `POST /foo/bar` can only be requested from localhost **and** by users from customer id `111...eef` @@ -166,7 +201,10 @@ class FooController { @Post('bar') // allow requests only from a specific customer - @AuthenticateCondition((request: Request, user: RequestUser) => user.customer_id === '1113e943-2187-4fdd-9c2c-54338fedaeef') + @AuthenticateCondition( + (request: Request, user: RequestUser) => + user.customer_id === '1113e943-2187-4fdd-9c2c-54338fedaeef', + ) async postBar() { /* ... */ } @@ -174,51 +212,55 @@ class FooController { ``` ### Note on authentication decorators + - The old authentication method placed the user data in the `request.body.info` field, this imposes certain issues regarding the request body because this data should be from the frontend without any modification by Maestro. Now this usage is ⚠️ **DEPRECATED** ⚠️. We are working to migrate to the `@User` parameter decorator. The old method is working while the migration is in progress. -- Authentication decorators can be used together and all of them **must** pass to the request be authenticated, but in the general case you don't need to (*and wouldn't like to...*) use all of them together, as you can code all of the authentication logic in the `@AuthenticateCondition` decorator. +- Authentication decorators can be used together and all of them **must** pass to the request be authenticated, but in the general case you don't need to (_and wouldn't like to..._) use all of them together, as you can code all of the authentication logic in the `@AuthenticateCondition` decorator. - ```ts - import { - RequireAllPermissions, - RequireSomePermission, - AuthenticateCondition, - } from '../../authentication/authentication.decorator'; - import { PERMISSIONS } from '../../authentication/permissions.enum'; - import { Waa, Baz } from './authenticationFunctions' + ```ts + import { + RequireAllPermissions, + RequireSomePermission, + AuthenticateCondition, + } from '../../authentication/authentication.decorator'; + import { PERMISSIONS } from '../../authentication/permissions.enum'; + import { Waa, Baz } from './authenticationFunctions'; - @Controller('foo') - @RequireAllPermissions(Permissions.FOO.USE, Permissions.FOO.REQUEST) - @RequireSomePermission(Permissions.FOO.MANAGE, Permissions.FOO.ADMIN) - @AuthenticateCondition(Waa) - @AuthenticateCondition(Baz) - class FooController { + @Controller('foo') + @RequireAllPermissions(Permissions.FOO.USE, Permissions.FOO.REQUEST) + @RequireSomePermission(Permissions.FOO.MANAGE, Permissions.FOO.ADMIN) + @AuthenticateCondition(Waa) + @AuthenticateCondition(Baz) + class FooController { + /* ... */ + + @Get('bar') + async getBar() { /* ... */ - - @Get('bar') - async getBar() { - /* ... */ - } - - @Post('bar') - @RequireAllPermissions(Permissions.BAR.MANAGE, Permissions.BAR.USE, Permissions.BAR.REQUEST) - async postBar() { - /* ... */ - } } - ``` + + @Post('bar') + @RequireAllPermissions( + Permissions.BAR.MANAGE, + Permissions.BAR.USE, + Permissions.BAR.REQUEST, + ) + async postBar() { + /* ... */ + } + } + ``` - If `@RequireAllPermissions` and `@RequireSomePermission` are used with **only a single permission**, they present the **exactly same behavior**. - ```ts - // same behavior - @RequireAllPermissions(Permissions.BAR.MANAGE) - @RequireSomePermission(Permissions.BAR.MANAGE) - ``` - - + ```ts + // same behavior + @RequireAllPermissions(Permissions.BAR.MANAGE) + @RequireSomePermission(Permissions.BAR.MANAGE) + ``` ## `@User` parameter decorator + The requesting user data can be obtained using the @User parameter decorator, like in the following snippet: ```ts @@ -264,12 +306,15 @@ class UserController { ``` ## 📦 Development + ### ⌨️ Coding Style + By default, we use [ESLint](https://eslint.org/) + [Prettier](https://prettier.io/) with default settings. **We recommend using Visual Studio Code and installing the recommended extensions to ease the development process.** ### Commits pattern + Our workflow pipeline follows the conventional commits specs ([cheat sheets](https://cheatography.com/albelop/cheat-sheets/conventional-commits/)) to release versions accordingly. Format: `[optional scope]: ` @@ -277,25 +322,29 @@ Format: `[optional scope]: ` Example: `FIX: ensure Range headers adhere more closely to RFC 2616` ### Branching naming convention + - **Feature**: Any code changes for a new module or use case should be done on a feature branch. This branch is created based on the `main` branch. When all changes are done, a Pull Request/Merge Request is needed to put all of these changes back to the `main` branch. Examples: `feature/integrate-swagger`, `feature/JIRA-1234`, `feature/JIRA-1234_support-dark-theme`. - **It is recommended to use all lower caps letters and hyphen (-) to separate words unless it is a specific item name or ID. Underscore (_) could be used to separate the ID and description.** + **It is recommended to use all lower caps letters and hyphen (-) to separate words unless it is a specific item name or ID. Underscore (\_) could be used to separate the ID and description.** -- **Bug Fix**: If the code changes made from the feature branch were rejected after a release, sprint or demo, any necessary fixes after that should be done on the bugfix branch. Examples: `bugfix/more-gray-shades`, `bugfix/JIRA-1444_gray-on-blur-fix`. +- **Bug Fix**: If the code changes made from the feature branch were rejected after a release, sprint or demo, any necessary fixes after that should be done on the bugfix branch. Examples: `bugfix/more-gray-shades`, `bugfix/JIRA-1444_gray-on-blur-fix`. - **Hot Fix**: If there is a need to fix a blocker, do a temporary patch, apply a critical framework or configuration change that should be handled immediately, it should be created as a Hotfix. Examples: `hotfix/disable-endpoint-zero-day-exploit`, `hotfix/increase-scaling-threshold`. - **Experimental**: A branch for playing around. Any new feature or idea that is not part of a release or a sprint. Example: `experimental/dark-theme-support`. ### Making a Pull Request + 1. Commit your changes 2. Open the Pull Request on GitHub 3. Send Pull Request link in Microsfera Google Chat Group for review and possible approval ## 🛠️ Built with + Some technologies used in this project: - [NestJS](https://docs.nestjs.com) - Framework for building efficient and scalable NodeJS server-side applications ## ⚙️ Back-end Architecture + The architecture can be found at [this link](https://sites.google.com/dadosfera.ai/wikidoproduto/time/back-end). diff --git a/docsfera.json b/docsfera.json index a4f3757..dee5148 100644 --- a/docsfera.json +++ b/docsfera.json @@ -3415,11 +3415,32 @@ "type": "string" } }, + { + "name": "size", + "required": false, + "in": "query", + "description": "Número de registros a ser retornado", + "schema": { + "minimum": 1, + "maximum": 10000, + "type": "number" + } + }, + { + "name": "page", + "required": false, + "in": "query", + "description": "Usado para paginação, em conjunto com `size`", + "schema": { + "minimum": 1, + "type": "number" + } + }, { "name": "sort_by", "required": false, "in": "query", - "description": "Data Asset field to sort", + "description": "Campo do data asset para usar na ordenação. Padrão: `created_at` ", "schema": { "type": "string" } @@ -3428,7 +3449,7 @@ "name": "order", "required": false, "in": "query", - "description": "Tipo de ordenação - asc: crescente; desc: decrescente ", + "description": "Tipo de ordenação - `asc`: crescente; `desc`: decrescente ", "schema": { "default": "asc", "enum": [ diff --git a/package.json b/package.json index 84e105f..b829842 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "build": "nest build", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", - "start:dev": "nest start --watch", - "start:debug": "nest start --debug --watch", - "start:kill": "export KILL_AFTER_START=1 && nest start && export KILL_AFTER_START=0", - "start:prod": "npm run build && node dist/main", + "start:dev": "export INTERNAL_SWAGGER=true && nest start --watch", + "start:debug": "npm run start:dev", + "start:prod": "node dist/main", + "docs": "export KILL_AFTER_START=1 && nest start && export INTERNAL_SWAGGER=true && nest start", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "test": "jest", "test:watch": "jest --watch", @@ -96,4 +96,4 @@ "tsconfig-paths": "^3.14.1", "typescript": "^4.6.3" } -} +} \ No newline at end of file From aa9e0536a76f3083150f6444af40024ce06fc6d1 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Fri, 17 Feb 2023 09:55:10 -0300 Subject: [PATCH 17/19] FIX: tests --- src/authentication/authentication.guard.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/authentication/authentication.guard.ts b/src/authentication/authentication.guard.ts index f97bdfe..7e938b0 100644 --- a/src/authentication/authentication.guard.ts +++ b/src/authentication/authentication.guard.ts @@ -54,11 +54,14 @@ export class AuthenticationGuard >(AUTH_FUNCTION_KEY, [ctx.getClass(), ctx.getHandler()]); const mustBeAuthenticated = authFunctions.length > 0; - if (!mustBeAuthenticated) return true; - const request = ctx.switchToHttp().getRequest(); const accessToken = this.validateToken(request, mustBeAuthenticated); + if (!mustBeAuthenticated) { + // no need to be authenticated + return true; + } + if (!accessToken) { // couldn't load valid token throw new ErrorBuilder(ErrorCodes.AUTH.UNAUTHORIZED); From 84b33708263e0f331699a364aacb0f74e6e08e40 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Fri, 17 Feb 2023 11:01:08 -0300 Subject: [PATCH 18/19] Update action --- .github/workflows/deploy-manually.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-manually.yml b/.github/workflows/deploy-manually.yml index df0718a..85ce80c 100644 --- a/.github/workflows/deploy-manually.yml +++ b/.github/workflows/deploy-manually.yml @@ -76,7 +76,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Update Pip run: | @@ -146,7 +146,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Extract Docs BlockId and PageId env: From 7ecb50315fa09388b80c688030398f11179c9812 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Fri, 17 Feb 2023 11:01:29 -0300 Subject: [PATCH 19/19] Update action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4193f15..76b8c70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: runs-on: self-hosted steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build env: