Files
maestro/src/modules/inputs/dtos/input.model.ts
T

68 lines
1.4 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
export class Column {
@ApiProperty()
name: string;
@ApiProperty()
type: string;
}
export class TableColumns {
@ApiProperty()
name: string;
@ApiProperty()
columns: string[];
@ApiPropertyOptional({ type: [Column] })
references: Column[];
@ApiProperty()
destination: Record<'raw' | 'qualify', {
table_name: string;
table_schema: string;
}> | null;
@ApiProperty()
type: string;
@ApiPropertyOptional({ type: [String] })
identifier_columns?: string[];
@ApiPropertyOptional({ type: Column })
reference_column?: Column;
}
export class AvailableEntity {
@ApiProperty()
name: string;
@ApiProperty()
replication_methods: string[];
}
export class Input {
@ApiProperty()
id: string;
@ApiProperty({ type: [TableColumns] })
tables: TableColumns[];
@ApiProperty()
name: string;
@ApiProperty()
description: string;
@ApiProperty()
plugin: string;
@ApiPropertyOptional()
type?: string;
@ApiProperty()
created_at: string;
@ApiProperty()
updated_at: string;
}
export class GetAvailableEntitiesReq {
@ApiProperty()
plugin: string;
}
export class GetAvailableEntitiesRes {
@ApiProperty({ type: [AvailableEntity] })
entities: AvailableEntity[];
}
export class CreateInputReq extends OmitType(Input, [
'id',
'created_at',
'updated_at',
]) {}