feat(fields): мягкое удаление полей формы — архив удалённых с восстановлением и блок «Удалённые поля» в задаче
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user