feat: привязка подсправочника к строкам родителя (parentRowIds)

This commit is contained in:
2026-07-21 10:43:28 +03:00
parent eff91bffad
commit 9edd90211f
6 changed files with 81 additions and 44 deletions

View File

@@ -795,7 +795,7 @@ export function registerDataTableRoutes(app: import("express").Express): void {
return res.status(403).json({ error: 'Нет прав для управления таблицей' });
}
const { childTableId, parentColumnIndex, childColumnIndex, parentValues } = req.body;
const { childTableId, parentColumnIndex, childColumnIndex, parentRowIds } = req.body;
if (!childTableId || typeof childTableId !== 'number') {
return res.status(400).json({ error: 'Необходимо указать подсправочник (childTableId)' });
}
@@ -811,7 +811,7 @@ export function registerDataTableRoutes(app: import("express").Express): void {
childTableId,
parentColumnIndex: parentColumnIndex ?? 0,
childColumnIndex: childColumnIndex ?? 0,
parentValues: Array.isArray(parentValues) ? parentValues : [],
parentRowIds: Array.isArray(parentRowIds) ? parentRowIds : [],
});
res.status(201).json({ link });
@@ -845,12 +845,12 @@ export function registerDataTableRoutes(app: import("express").Express): void {
return res.status(404).json({ error: 'Связь не найдена' });
}
const { childTableId, parentColumnIndex, childColumnIndex, parentValues } = req.body;
const { childTableId, parentColumnIndex, childColumnIndex, parentRowIds } = req.body;
const updates: Partial<import("@shared/schema").DataTableLink> = {};
if (childTableId !== undefined) updates.childTableId = childTableId;
if (parentColumnIndex !== undefined) updates.parentColumnIndex = parentColumnIndex;
if (childColumnIndex !== undefined) updates.childColumnIndex = childColumnIndex;
if (parentValues !== undefined) updates.parentValues = Array.isArray(parentValues) ? parentValues : [];
if (parentRowIds !== undefined) updates.parentRowIds = Array.isArray(parentRowIds) ? parentRowIds : [];
const link = await storage.updateDataTableLink(linkId, req.organizationId!, updates);
res.json({ link });