Скорректированы dto и sql инструкции для новой базы данных cloud-beta.
This commit is contained in:
@@ -2,8 +2,6 @@ export type EdgeItemDto = {
|
||||
id: string;
|
||||
name: string;
|
||||
parentId: string | null;
|
||||
tagIds: string[];
|
||||
tagCount: number;
|
||||
};
|
||||
|
||||
export type EdgeResponseDto = {
|
||||
|
||||
@@ -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,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -2,6 +2,4 @@ export type EdgeRow = {
|
||||
id: string;
|
||||
name: string;
|
||||
parent_id: string | null;
|
||||
tag_ids: string[];
|
||||
tag_count: number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user