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"])
|
||||
/// ماژولهای فعال منو برای این محیط
|
||||
enabledModules String[] @default([])
|
||||
/// اولین لحظهٔ روشن شدن «بایگانی اطلاعات قبل»؛ مرز فعالیتهای قبلی
|
||||
/// تاریخ قطع بایگانی اطلاعات قبل (شروع روز انتخابشده)؛ null = بدون فیلتر
|
||||
priorArchiveEnabledAt DateTime?
|
||||
isActive Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
@@ -600,6 +600,8 @@ model Deal {
|
||||
code String?
|
||||
/// منبع ورود: manual | didar | excel
|
||||
importSource String @default("manual")
|
||||
/// اگر پر باشد، رکورد از بایگانی به کار جاری منتقل شده (فقط برچسب؛ بقیه فیلدها دستنخورده)
|
||||
promotedFromPriorAt DateTime?
|
||||
/// شناسه در مبدأ (کد دیدار معامله)
|
||||
sourceRef String?
|
||||
amount Decimal? @db.Decimal(18, 2)
|
||||
@@ -650,6 +652,7 @@ model Deal {
|
||||
@@index([companyId])
|
||||
@@index([ownerId])
|
||||
@@index([organizationId, sourceRef])
|
||||
@@index([organizationId, createdAt])
|
||||
}
|
||||
|
||||
/// مراحل/ستونهای فعالیت (تب و کانبان) — kind وضعیت فعالیت داخل این مرحله را تعیین میکند
|
||||
@@ -703,6 +706,8 @@ model Activity {
|
||||
title String
|
||||
/// manual | didar — سابقهٔ منتقلشده از اطلاعات قبل
|
||||
importSource String @default("manual")
|
||||
/// اگر پر باشد، رکورد از بایگانی به کار جاری منتقل شده (فقط برچسب؛ بقیه فیلدها دستنخورده)
|
||||
promotedFromPriorAt DateTime?
|
||||
description String?
|
||||
dueAt DateTime?
|
||||
durationMinutes Int?
|
||||
@@ -750,6 +755,7 @@ model Activity {
|
||||
@@index([leadId])
|
||||
@@index([organizationId, status, dueAt])
|
||||
@@index([organizationId, importSource])
|
||||
@@index([organizationId, createdAt])
|
||||
@@index([organizationId, assigneeId])
|
||||
@@index([organizationId, createdById])
|
||||
@@index([reminderAt, reminderSentAt])
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface AuthUserDto {
|
||||
/** خلاصه اشتراک مالک محیط (برای اعضا فقط جهت نمایش/گیت ورود) */
|
||||
subscription?: SubscriptionSummaryDto | null;
|
||||
/** اگر باشد، این کاربر سوئیچ «بایگانی اطلاعات قبل» را دارد */
|
||||
priorArchive?: { lens: "current" | "archive" } | null;
|
||||
priorArchive?: { lens: "current" | "archive"; cutoffAt: string | null } | null;
|
||||
}
|
||||
|
||||
export type BillingPlanCode =
|
||||
@@ -631,6 +631,12 @@ export interface OrganizationDto {
|
||||
enabledCurrencies: string[];
|
||||
exchangeRates: ExchangeRateDto[];
|
||||
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 {
|
||||
@@ -951,6 +957,7 @@ export interface DealDto {
|
||||
code: string | null;
|
||||
/** منبع ورود: manual | didar | excel */
|
||||
importSource: string;
|
||||
promotedFromPriorAt: string | null;
|
||||
/** شناسه در مبدأ (کد دیدار) */
|
||||
sourceRef: string | null;
|
||||
amount: number | null;
|
||||
@@ -1477,6 +1484,7 @@ export interface ActivityDto {
|
||||
completedAt: string | null;
|
||||
/** manual یا didar؛ برای جدا کردن سابقهٔ قبلی */
|
||||
importSource?: string;
|
||||
promotedFromPriorAt?: string | null;
|
||||
tags: string[];
|
||||
person: PersonSummaryDto | null;
|
||||
company: CompanySummaryDto | null;
|
||||
|
||||
Reference in New Issue
Block a user