mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-10 02:29:09 +00:00
128 lines
2.5 KiB
TypeScript
128 lines
2.5 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
|
import { IsString, IsOptional, IsNumber, Max } 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;
|
|
}
|
|
export class TableMetadataDto {
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty({ type: [ColumnDto] })
|
|
columns: ColumnDto[];
|
|
@ApiProperty({ type: [ColumnDto] })
|
|
references: ColumnDto[];
|
|
}
|
|
|
|
export class ConnectionTestPingReq {
|
|
@ApiProperty()
|
|
@IsString()
|
|
plugin: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
host: string;
|
|
|
|
@ApiProperty()
|
|
@IsNumber()
|
|
@Max(65535)
|
|
port: number;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
network_config_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 ConnectionTestListTablesRes {
|
|
@ApiProperty()
|
|
operation_result: boolean;
|
|
@ApiProperty()
|
|
table_list: string[];
|
|
}
|
|
|
|
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[];
|
|
}
|