mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-01 01:59:07 +00:00
361 lines
7.1 KiB
TypeScript
361 lines
7.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional, PickType } from '@nestjs/swagger';
|
|
import { CreateDataAssetRequest } from '@dadosfera/protospack-v2/dist/lib/Catalog/interfaces/messages';
|
|
|
|
export enum DataAssetShareType {
|
|
none = 'none',
|
|
public = 'public',
|
|
private = 'private',
|
|
}
|
|
export enum OrderEnum {
|
|
asc = 'asc',
|
|
desc = 'desc',
|
|
}
|
|
export class EmbedObject {
|
|
@ApiProperty()
|
|
url: string;
|
|
}
|
|
export class IRole {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
id: string;
|
|
}
|
|
|
|
export class IUser {
|
|
@ApiProperty()
|
|
username: string;
|
|
@ApiProperty()
|
|
id: string;
|
|
}
|
|
|
|
export class IComment {
|
|
@ApiProperty()
|
|
id: number;
|
|
@ApiProperty()
|
|
message: string;
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiProperty()
|
|
username: string;
|
|
}
|
|
|
|
export class IDataAsset {
|
|
@ApiProperty()
|
|
id: number;
|
|
@ApiPropertyOptional()
|
|
database_name?: string;
|
|
@ApiPropertyOptional()
|
|
table_name?: string;
|
|
@ApiPropertyOptional()
|
|
num_columns?: number;
|
|
@ApiPropertyOptional()
|
|
location?: string;
|
|
@ApiPropertyOptional()
|
|
created_time?: string;
|
|
@ApiPropertyOptional()
|
|
table_type?: string;
|
|
@ApiPropertyOptional()
|
|
size_in_bytes?: number;
|
|
@ApiPropertyOptional()
|
|
num_files?: number;
|
|
@ApiPropertyOptional()
|
|
data_encrypted?: string;
|
|
@ApiPropertyOptional()
|
|
num_rows?: number;
|
|
@ApiProperty()
|
|
display_name: string;
|
|
@ApiProperty()
|
|
pipeline_id: string;
|
|
@ApiProperty()
|
|
user_id: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
@ApiProperty()
|
|
data_asset_type: string;
|
|
@ApiProperty()
|
|
tags: string[];
|
|
@ApiProperty()
|
|
owner: string;
|
|
@ApiProperty({ type: [IRole] })
|
|
roles: IRole[];
|
|
@ApiProperty({ type: [IUser] })
|
|
users: IUser[];
|
|
@ApiPropertyOptional()
|
|
dashboard_id?: number;
|
|
@ApiPropertyOptional()
|
|
name?: string;
|
|
@ApiPropertyOptional()
|
|
parameters?: string[];
|
|
@ApiPropertyOptional()
|
|
embedding_params?: object;
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiPropertyOptional()
|
|
updated_at?: string;
|
|
@ApiProperty({ type: [IComment] })
|
|
comments: IComment[];
|
|
@ApiPropertyOptional()
|
|
embed?: EmbedObject;
|
|
@ApiPropertyOptional({ enum: DataAssetShareType })
|
|
share_type?: DataAssetShareType;
|
|
@ApiPropertyOptional()
|
|
docs?: string;
|
|
}
|
|
|
|
export class IOneDataAsset {
|
|
@ApiProperty()
|
|
data_asset: IDataAsset;
|
|
}
|
|
|
|
export class IMakeAComment {
|
|
@ApiProperty()
|
|
message: string;
|
|
}
|
|
|
|
export class CommentToDelete extends PickType(IComment, ['id', 'username']) {}
|
|
export class IDeleteComment {
|
|
@ApiProperty()
|
|
comment: CommentToDelete;
|
|
}
|
|
|
|
export class ICatalogAllRequest {
|
|
@ApiPropertyOptional({
|
|
description: 'Texto usado para filtrar os ativos no catálogo.',
|
|
})
|
|
search;
|
|
|
|
@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 ',
|
|
})
|
|
order?: OrderEnum;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'ID do usuário owner para filtrar data assets',
|
|
example: 'user-id-1,user-id-2',
|
|
})
|
|
owner?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Data inicial para filtro de catálogo (formato: YYYY-MM-DD)',
|
|
example: '2025-01-01',
|
|
})
|
|
catalog_date_from?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Data final para filtro de catálogo (formato: YYYY-MM-DD)',
|
|
example: '2025-12-31',
|
|
})
|
|
catalog_date_to?: string;
|
|
}
|
|
|
|
export class ICatalogAllResponse {
|
|
@ApiProperty({ type: [IDataAsset] })
|
|
data_assets: IDataAsset[];
|
|
@ApiProperty()
|
|
total: number;
|
|
}
|
|
|
|
export class IData {
|
|
@ApiProperty()
|
|
var: number;
|
|
@ApiProperty()
|
|
date: string;
|
|
@ApiProperty()
|
|
last: number;
|
|
@ApiProperty()
|
|
maximum: number;
|
|
@ApiProperty()
|
|
minimum: number;
|
|
@ApiProperty()
|
|
day_opening: number;
|
|
}
|
|
|
|
export class IUpdateDataRequest {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
@ApiProperty()
|
|
tags: string[];
|
|
@ApiPropertyOptional()
|
|
embed: EmbedObject;
|
|
@ApiPropertyOptional({ enum: DataAssetShareType })
|
|
share_type?: DataAssetShareType;
|
|
@ApiPropertyOptional()
|
|
docs?: string;
|
|
}
|
|
export class ICreateDataAsset implements CreateDataAssetRequest {
|
|
@ApiProperty()
|
|
display_name: string;
|
|
@ApiProperty()
|
|
description: string;
|
|
@ApiProperty()
|
|
data_asset_type: string;
|
|
@ApiProperty()
|
|
external_url: string;
|
|
@ApiProperty()
|
|
location: string;
|
|
@ApiPropertyOptional()
|
|
embed: EmbedObject;
|
|
@ApiPropertyOptional()
|
|
docs: string;
|
|
}
|
|
|
|
export class IPreview {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
database_name: string;
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty({ type: [IData] })
|
|
data: IData[];
|
|
}
|
|
|
|
export class IDocs {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
docs: string;
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
@ApiProperty()
|
|
table_id: string;
|
|
}
|
|
|
|
export class IColumnMetadata {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty()
|
|
column_name: string;
|
|
@ApiProperty()
|
|
data_type: string;
|
|
@ApiProperty()
|
|
missing_count: string;
|
|
@ApiProperty()
|
|
min: string;
|
|
@ApiProperty()
|
|
max: string;
|
|
@ApiProperty()
|
|
count: string;
|
|
@ApiProperty()
|
|
histogram: string;
|
|
@ApiProperty()
|
|
mean: string;
|
|
@ApiProperty()
|
|
median: string;
|
|
@ApiProperty()
|
|
missing_rate: string;
|
|
@ApiProperty()
|
|
stddev: string;
|
|
@ApiProperty()
|
|
unique_count: string;
|
|
@ApiProperty()
|
|
unique_rate: string;
|
|
@ApiProperty()
|
|
analyzer_rules: string[];
|
|
@ApiProperty()
|
|
version: string;
|
|
}
|
|
|
|
export class IPreviewResponse {
|
|
@ApiProperty()
|
|
preview: IPreview;
|
|
}
|
|
|
|
export class IDocsResponse {
|
|
@ApiProperty()
|
|
docs: IDocs;
|
|
}
|
|
|
|
export class IColumnsMetadataResponse {
|
|
@ApiProperty({ type: [IColumnMetadata] })
|
|
columns_metadata: IColumnMetadata[];
|
|
}
|
|
|
|
export class TriggerCatalogReq {
|
|
@ApiProperty({
|
|
description: 'Name of the table on Snowflake',
|
|
example: 'TB__4DXSD4_TEST',
|
|
})
|
|
table_name: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Schema where the asset is located. If not set defaults to "PUBLIC"',
|
|
})
|
|
table_schema?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Id of the pipeline that generated the asset.',
|
|
})
|
|
pipeline_id: string;
|
|
}
|
|
|
|
export class TriggerCatalogRes {
|
|
@ApiProperty()
|
|
session: string;
|
|
}
|
|
|
|
export class GetDatasetCatalogTaskRes {
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiProperty()
|
|
customer_name: string;
|
|
@ApiProperty()
|
|
session_id: string;
|
|
@ApiProperty()
|
|
status: string;
|
|
@ApiProperty()
|
|
table_name: string;
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
@ApiProperty()
|
|
updated_by: string;
|
|
}
|
|
|
|
export class BatchRemoveRlsRulesRequest {
|
|
@ApiPropertyOptional()
|
|
nimbus_dashboard_id?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
id_rls?: string;
|
|
}
|
|
|
|
export type AssetReporter = {
|
|
id: string;
|
|
display_name: string;
|
|
data_asset_type: string;
|
|
created_at: string;
|
|
tags: string;
|
|
}
|
|
|
|
export type CreateDataDocsDTO = {
|
|
table_id: string;
|
|
docs: string;
|
|
asset_type: string;
|
|
|
|
} |