mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-15 10:59:08 +00:00
Beta's refresh-catalog RefreshCatalogReq DTO restricted plugin to
oracle/mysql/postgresql/sqlserver. Under the cache-first catalog model
(adopted for CDC in the beta merge), the CDC schema-fetch flow posts
/connection-test/refresh-catalog with plugin=mysql_cdc, which the @IsIn
rejected ("plugin must be one of: oracle, mysql, postgresql, sqlserver").
Add mysql_cdc/postgresql_cdc/oracle_cdc to the @IsIn and @ApiProperty enum,
matching the platform connection-test SQS plugin set. docsfera.json regenerated.
Co-Authored-By: WOZCODE <contact@withwoz.com>
225 lines
4.1 KiB
TypeScript
225 lines
4.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
|
import { IsIn, IsString, IsOptional } from 'class-validator';
|
|
import { DatabaseConnectionPropertiesDto } from 'src/modules/connection/dtos/connection';
|
|
import { CreateConnectionDto } from 'src/modules/connection/dtos/connection';
|
|
export class ColumnDto {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
type: string;
|
|
@ApiProperty()
|
|
is_primary_key: boolean;
|
|
}
|
|
export class TableMetadataDto {
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty({ type: [ColumnDto] })
|
|
columns: ColumnDto[];
|
|
@ApiProperty({ type: [ColumnDto] })
|
|
references: ColumnDto[];
|
|
}
|
|
|
|
export class ConnectionTestPingReq {
|
|
@ApiPropertyOptional()
|
|
@IsString()
|
|
@IsOptional()
|
|
plugin: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsString()
|
|
@IsOptional()
|
|
host: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
port: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
network_config_id?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
connection_id: string;
|
|
}
|
|
|
|
export class ConnectionTestPingRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
}
|
|
|
|
export class ConnectionTestCredentialsProperties extends OmitType(
|
|
DatabaseConnectionPropertiesDto,
|
|
['plugin', 'credentials_type'],
|
|
) {}
|
|
export class ConnectionTestCredentialsReq extends OmitType(
|
|
CreateConnectionDto,
|
|
['properties'],
|
|
) {
|
|
@ApiProperty()
|
|
properties: ConnectionTestCredentialsProperties;
|
|
@ApiPropertyOptional()
|
|
connection_id?: string;
|
|
}
|
|
|
|
export class ConnectionTestCredentialsRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty()
|
|
connection_id: string;
|
|
}
|
|
|
|
export class ConnectionTestListSchemasReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
connection_id: string;
|
|
}
|
|
|
|
export class ConnectionTestListSchemasRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty()
|
|
schema_list: string[];
|
|
}
|
|
|
|
export class ConnectionTestListTablesReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
connection_id: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
schema: string;
|
|
}
|
|
|
|
export class ConnectionTestListTablesEntry {
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty({ type: [String] })
|
|
primary_keys: string[];
|
|
}
|
|
|
|
export class ConnectionTestListTablesRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty()
|
|
table_list: string[];
|
|
@ApiProperty({ type: [ConnectionTestListTablesEntry] })
|
|
tables: ConnectionTestListTablesEntry[];
|
|
}
|
|
|
|
export class GetTableMetadataReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
connection_id: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
schema: string;
|
|
|
|
@ApiProperty()
|
|
@IsString({ each: true })
|
|
table_list: string[];
|
|
}
|
|
|
|
export class GetTableMetadataRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty({ type: [TableMetadataDto] })
|
|
tables_metadata: TableMetadataDto[];
|
|
}
|
|
|
|
export class CdcCheckDto {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
expected: string;
|
|
@ApiProperty()
|
|
actual: string;
|
|
@ApiProperty()
|
|
passed: boolean;
|
|
}
|
|
|
|
export class ValidateCdcPrerequisitesReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
connection_id: string;
|
|
}
|
|
|
|
export class ValidateCdcPrerequisitesRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty({ type: [CdcCheckDto] })
|
|
checks: CdcCheckDto[];
|
|
}
|
|
|
|
export class RefreshCatalogReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
connection_id: string;
|
|
|
|
@ApiProperty({
|
|
enum: [
|
|
'oracle',
|
|
'mysql',
|
|
'postgresql',
|
|
'sqlserver',
|
|
'mysql_cdc',
|
|
'postgresql_cdc',
|
|
'oracle_cdc',
|
|
],
|
|
})
|
|
@IsIn([
|
|
'oracle',
|
|
'mysql',
|
|
'postgresql',
|
|
'sqlserver',
|
|
'mysql_cdc',
|
|
'postgresql_cdc',
|
|
'oracle_cdc',
|
|
])
|
|
plugin: string;
|
|
}
|
|
|
|
export class RefreshCatalogStatusReq extends RefreshCatalogReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
session_id: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
date: string;
|
|
}
|
|
|
|
export class RefreshCatalogRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
|
|
@ApiProperty()
|
|
status: string;
|
|
|
|
@ApiProperty()
|
|
session_id: string;
|
|
|
|
@ApiProperty()
|
|
date: string;
|
|
}
|