feat: add prior-archive promote fields and shared cutoff DTOs
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
-- Prior archive: promote tag + cutoff query indexes
|
||||||
|
ALTER TABLE "Deal" ADD COLUMN "promotedFromPriorAt" TIMESTAMP(3);
|
||||||
|
|
||||||
|
ALTER TABLE "Activity" ADD COLUMN "promotedFromPriorAt" TIMESTAMP(3);
|
||||||
|
|
||||||
|
CREATE INDEX "Deal_organizationId_createdAt_idx" ON "Deal"("organizationId", "createdAt");
|
||||||
|
|
||||||
|
CREATE INDEX "Activity_organizationId_createdAt_idx" ON "Activity"("organizationId", "createdAt");
|
||||||
@@ -150,7 +150,7 @@ model Organization {
|
|||||||
enabledCurrencies String[] @default(["IRR", "USD", "EUR"])
|
enabledCurrencies String[] @default(["IRR", "USD", "EUR"])
|
||||||
/// ماژولهای فعال منو برای این محیط
|
/// ماژولهای فعال منو برای این محیط
|
||||||
enabledModules String[] @default([])
|
enabledModules String[] @default([])
|
||||||
/// اولین لحظهٔ روشن شدن «بایگانی اطلاعات قبل»؛ مرز فعالیتهای قبلی
|
/// تاریخ قطع بایگانی اطلاعات قبل (شروع روز انتخابشده)؛ null = بدون فیلتر
|
||||||
priorArchiveEnabledAt DateTime?
|
priorArchiveEnabledAt DateTime?
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
@@ -600,6 +600,8 @@ model Deal {
|
|||||||
code String?
|
code String?
|
||||||
/// منبع ورود: manual | didar | excel
|
/// منبع ورود: manual | didar | excel
|
||||||
importSource String @default("manual")
|
importSource String @default("manual")
|
||||||
|
/// اگر پر باشد، رکورد از بایگانی به کار جاری منتقل شده (فقط برچسب؛ بقیه فیلدها دستنخورده)
|
||||||
|
promotedFromPriorAt DateTime?
|
||||||
/// شناسه در مبدأ (کد دیدار معامله)
|
/// شناسه در مبدأ (کد دیدار معامله)
|
||||||
sourceRef String?
|
sourceRef String?
|
||||||
amount Decimal? @db.Decimal(18, 2)
|
amount Decimal? @db.Decimal(18, 2)
|
||||||
@@ -650,6 +652,7 @@ model Deal {
|
|||||||
@@index([companyId])
|
@@index([companyId])
|
||||||
@@index([ownerId])
|
@@index([ownerId])
|
||||||
@@index([organizationId, sourceRef])
|
@@index([organizationId, sourceRef])
|
||||||
|
@@index([organizationId, createdAt])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// مراحل/ستونهای فعالیت (تب و کانبان) — kind وضعیت فعالیت داخل این مرحله را تعیین میکند
|
/// مراحل/ستونهای فعالیت (تب و کانبان) — kind وضعیت فعالیت داخل این مرحله را تعیین میکند
|
||||||
@@ -703,6 +706,8 @@ model Activity {
|
|||||||
title String
|
title String
|
||||||
/// manual | didar — سابقهٔ منتقلشده از اطلاعات قبل
|
/// manual | didar — سابقهٔ منتقلشده از اطلاعات قبل
|
||||||
importSource String @default("manual")
|
importSource String @default("manual")
|
||||||
|
/// اگر پر باشد، رکورد از بایگانی به کار جاری منتقل شده (فقط برچسب؛ بقیه فیلدها دستنخورده)
|
||||||
|
promotedFromPriorAt DateTime?
|
||||||
description String?
|
description String?
|
||||||
dueAt DateTime?
|
dueAt DateTime?
|
||||||
durationMinutes Int?
|
durationMinutes Int?
|
||||||
@@ -750,6 +755,7 @@ model Activity {
|
|||||||
@@index([leadId])
|
@@index([leadId])
|
||||||
@@index([organizationId, status, dueAt])
|
@@index([organizationId, status, dueAt])
|
||||||
@@index([organizationId, importSource])
|
@@index([organizationId, importSource])
|
||||||
|
@@index([organizationId, createdAt])
|
||||||
@@index([organizationId, assigneeId])
|
@@index([organizationId, assigneeId])
|
||||||
@@index([organizationId, createdById])
|
@@index([organizationId, createdById])
|
||||||
@@index([reminderAt, reminderSentAt])
|
@@index([reminderAt, reminderSentAt])
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export interface AuthUserDto {
|
|||||||
/** خلاصه اشتراک مالک محیط (برای اعضا فقط جهت نمایش/گیت ورود) */
|
/** خلاصه اشتراک مالک محیط (برای اعضا فقط جهت نمایش/گیت ورود) */
|
||||||
subscription?: SubscriptionSummaryDto | null;
|
subscription?: SubscriptionSummaryDto | null;
|
||||||
/** اگر باشد، این کاربر سوئیچ «بایگانی اطلاعات قبل» را دارد */
|
/** اگر باشد، این کاربر سوئیچ «بایگانی اطلاعات قبل» را دارد */
|
||||||
priorArchive?: { lens: "current" | "archive" } | null;
|
priorArchive?: { lens: "current" | "archive"; cutoffAt: string | null } | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BillingPlanCode =
|
export type BillingPlanCode =
|
||||||
@@ -631,6 +631,12 @@ export interface OrganizationDto {
|
|||||||
enabledCurrencies: string[];
|
enabledCurrencies: string[];
|
||||||
exchangeRates: ExchangeRateDto[];
|
exchangeRates: ExchangeRateDto[];
|
||||||
enabledModules: OrgModuleKey[];
|
enabledModules: OrgModuleKey[];
|
||||||
|
priorArchiveCutoffAt?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdatePriorArchiveCutoffRequest {
|
||||||
|
/** ISO datetime (start of selected Jalali day) or null to clear */
|
||||||
|
cutoffAt: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateOrganizationRequest {
|
export interface UpdateOrganizationRequest {
|
||||||
@@ -951,6 +957,7 @@ export interface DealDto {
|
|||||||
code: string | null;
|
code: string | null;
|
||||||
/** منبع ورود: manual | didar | excel */
|
/** منبع ورود: manual | didar | excel */
|
||||||
importSource: string;
|
importSource: string;
|
||||||
|
promotedFromPriorAt: string | null;
|
||||||
/** شناسه در مبدأ (کد دیدار) */
|
/** شناسه در مبدأ (کد دیدار) */
|
||||||
sourceRef: string | null;
|
sourceRef: string | null;
|
||||||
amount: number | null;
|
amount: number | null;
|
||||||
@@ -1477,6 +1484,7 @@ export interface ActivityDto {
|
|||||||
completedAt: string | null;
|
completedAt: string | null;
|
||||||
/** manual یا didar؛ برای جدا کردن سابقهٔ قبلی */
|
/** manual یا didar؛ برای جدا کردن سابقهٔ قبلی */
|
||||||
importSource?: string;
|
importSource?: string;
|
||||||
|
promotedFromPriorAt?: string | null;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
person: PersonSummaryDto | null;
|
person: PersonSummaryDto | null;
|
||||||
company: CompanySummaryDto | null;
|
company: CompanySummaryDto | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user