Скорректированы dto и sql инструкции для новой базы данных cloud-beta.

This commit is contained in:
Первов Артем
2026-07-01 21:50:05 +03:00
parent 14a75acb15
commit cc3c5fab06
10 changed files with 10 additions and 37 deletions

View File

@@ -2,8 +2,6 @@ export type EdgeItemDto = {
id: string;
name: string;
parentId: string | null;
tagIds: string[];
tagCount: number;
};
export type EdgeResponseDto = {

View File

@@ -8,8 +8,6 @@ export function createEdgeResponse(rows: EdgeRow[]): EdgeResponseDto {
id: row.id,
name: row.name,
parentId: row.parent_id,
tagIds: row.tag_ids ?? [],
tagCount: row.tag_count,
})),
};
}

View File

@@ -6,16 +6,14 @@ import { EdgeRow } from './edge.types';
export class EdgeRepository {
constructor(private readonly db: DbService) {}
/** Читает каталог edge без расчетов по текущим значениям. */
/** Reads the edge catalog. */
async findAll(parentId: string | null, search: string | null): Promise<EdgeRow[]> {
const result = await this.db.query<EdgeRow>(
`
SELECT
e.id,
e.name,
e.parent_id,
e.tag_ids,
cardinality(e.tag_ids)::integer AS tag_count
e.parent_id
FROM edge AS e
WHERE ($1::varchar IS NULL OR e.parent_id = $1::varchar)
AND (

View File

@@ -2,6 +2,4 @@ export type EdgeRow = {
id: string;
name: string;
parent_id: string | null;
tag_ids: string[];
tag_count: number;
};