feat(fields): мягкое удаление полей формы — архив удалённых с восстановлением и блок «Удалённые поля» в задаче

This commit is contained in:
2026-09-21 14:35:45 +03:00
parent d5f2925886
commit e3f0ebfb89
18 changed files with 296 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
import { db } from "../db";
import { eq, and, sql } from "drizzle-orm";
import { eq, and, sql, isNull } from "drizzle-orm";
import { tasks, taskFieldValues, contractNumberCounters, forms, formFields } from "@shared/schema";
export interface ContractNumberConfig {
@@ -50,7 +50,8 @@ async function getTaskFieldValueByCode(
.where(
and(
eq(formFields.formId, task.tasks.formId),
eq(formFields.code, fieldCode)
eq(formFields.code, fieldCode),
isNull(formFields.deletedAt)
)
)
.limit(1);

View File

@@ -44,7 +44,8 @@ export async function getGanttFieldsByForm(formIds: number[], organizationId: nu
.where(and(
inArray(formFields.formId, formIds),
eq(forms.organizationId, organizationId),
sql`${formFields.ganttRole} IS NOT NULL`
sql`${formFields.ganttRole} IS NOT NULL`,
isNull(formFields.deletedAt)
));
return rows
@@ -146,7 +147,8 @@ export async function shiftRelatedTasks(
.innerJoin(forms, eq(formFields.formId, forms.id))
.where(and(
eq(forms.organizationId, organizationId),
sql`${formFields.ganttRole} IS NOT NULL`
sql`${formFields.ganttRole} IS NOT NULL`,
isNull(formFields.deletedAt)
));
const validFields: GanttFieldInfo[] = allGanttFields