Add Didar gap features: lost-reason reports, audit logs, tags, card assignees, and saved-views API.

Ignore Graphify local artifacts and expose new modules in superadmin.
This commit is contained in:
2026-09-26 14:59:48 +03:30
parent 35a618d0af
commit 6463275c3d
30 changed files with 1406 additions and 21 deletions
+81 -3
View File
@@ -116,7 +116,9 @@ export type OrgModuleKey =
| "custom_fields"
| "currencies"
| "team_settings"
| "faq";
| "faq"
| "audit_logs"
| "saved_views";
export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"customers",
@@ -143,6 +145,8 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
"currencies",
"team_settings",
"faq",
"audit_logs",
"saved_views",
];
export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
@@ -170,6 +174,8 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
currencies: "ارزها",
team_settings: "تیم و تنظیمات سازمان",
faq: "FAQ",
audit_logs: "لاگ فعالیت کاربران",
saved_views: "فیلترهای ذخیره‌شده",
};
export const ORG_MODULE_GROUPS: Array<{
@@ -204,11 +210,18 @@ export const ORG_MODULE_GROUPS: Array<{
"attachments",
"loyalty",
"reports",
"saved_views",
],
},
{
title: "تنظیمات",
keys: ["team_settings", "custom_fields", "currencies", "tahesab"],
keys: [
"team_settings",
"custom_fields",
"currencies",
"tahesab",
"audit_logs",
],
},
];
@@ -279,7 +292,8 @@ export type RolePermissionKey =
| "products"
| "activities"
| "notes"
| "reports";
| "reports"
| "audit";
export const ROLE_PERMISSION_ITEMS: Array<{
key: RolePermissionKey;
@@ -292,6 +306,7 @@ export const ROLE_PERMISSION_ITEMS: Array<{
{ key: "activities", label: "فعالیت‌ها" },
{ key: "notes", label: "یادداشت‌ها" },
{ key: "reports", label: "گزارش‌ها" },
{ key: "audit", label: "لاگ فعالیت کاربران" },
];
export interface OrgRoleMemberDto {
@@ -582,6 +597,7 @@ export interface CompanyDto {
website: string | null;
address: string | null;
notes: string | null;
tags: string[];
customFields: Record<string, unknown>;
peopleCount: number;
owner: UserSummaryDto | null;
@@ -597,6 +613,7 @@ export interface CreateCompanyRequest {
website?: string;
address?: string;
notes?: string;
tags?: string[];
customFields?: Record<string, unknown>;
ownerId?: string | null;
}
@@ -633,6 +650,7 @@ export interface PersonDto {
referrer: string | null;
notes: string | null;
mood: PersonMood;
tags: string[];
customFields: Record<string, unknown>;
loyaltyPoints: number;
loyaltyTier: LoyaltyTierSummaryDto | null;
@@ -653,6 +671,7 @@ export interface CreatePersonRequest {
referrer?: string;
notes?: string;
mood?: PersonMood;
tags?: string[];
companyId?: string | null;
customFields?: Record<string, unknown>;
ownerId?: string | null;
@@ -845,6 +864,7 @@ export interface ActivityDto {
reminderNotifyApp: boolean;
reminderNotifySms: boolean;
completedAt: string | null;
tags: string[];
person: PersonSummaryDto | null;
company: CompanySummaryDto | null;
deal: DealSummaryDto | null;
@@ -864,6 +884,7 @@ export interface CreateActivityRequest {
reminderAt?: string | null;
reminderNotifyApp?: boolean;
reminderNotifySms?: boolean;
tags?: string[];
personId?: string | null;
companyId?: string | null;
dealId?: string | null;
@@ -881,6 +902,7 @@ export interface UpdateActivityRequest {
reminderAt?: string | null;
reminderNotifyApp?: boolean;
reminderNotifySms?: boolean;
tags?: string[];
personId?: string | null;
companyId?: string | null;
dealId?: string | null;
@@ -2021,6 +2043,7 @@ export interface ReportsDashboardDto {
monthlyComparison: ReportsSeriesPointDto[];
customerGrowth: ReportsSeriesPointDto[];
sources: ReportsSliceDto[];
lostReasons: ReportsSliceDto[];
salesByCategory: ReportsSliceDto[];
topProducts: ReportsTopProductDto[];
customerStatus: ReportsSliceDto[];
@@ -2125,10 +2148,12 @@ export interface ProjectCardDto {
position: number;
boardId: string;
stageId: string;
tags: string[];
person: PersonSummaryDto | null;
company: CompanySummaryDto | null;
deal: { id: string; title: string } | null;
owner: UserSummaryDto | null;
assignees: UserSummaryDto[];
createdAt: string;
updatedAt: string;
}
@@ -2151,10 +2176,12 @@ export interface CreateProjectCardRequest {
boardId?: string;
stageId?: string;
notes?: string;
tags?: string[];
personId?: string | null;
companyId?: string | null;
dealId?: string | null;
ownerId?: string | null;
assigneeIds?: string[];
}
export type UpdateProjectCardRequest = Partial<CreateProjectCardRequest>;
@@ -2891,3 +2918,54 @@ export interface ResetPlatformUserPasswordRequest {
export { brand, APP_NAME, APP_NAME_FA, brandSuggestionFa } from "./brand";
export type { Brand } from "./brand";
export const API_PREFIX = "api";
/* ——— لاگ فعالیت کاربران ——— */
export interface AuditLogDto {
id: string;
action: string;
method: string;
path: string;
entityType: string | null;
entityId: string | null;
summary: string;
actor: UserSummaryDto | null;
ip: string | null;
createdAt: string;
}
export interface AuditLogListResponse {
items: AuditLogDto[];
total: number;
page: number;
limit: number;
}
/* ——— فیلترهای ذخیره‌شده ——— */
export type SavedViewScope =
| "deals"
| "people"
| "companies"
| "activities"
| "project_cards";
export interface SavedViewDto {
id: string;
name: string;
scope: SavedViewScope;
filters: Record<string, unknown>;
isShared: boolean;
owner: UserSummaryDto | null;
createdAt: string;
updatedAt: string;
}
export interface CreateSavedViewRequest {
name: string;
scope: SavedViewScope;
filters: Record<string, unknown>;
isShared?: boolean;
}
export type UpdateSavedViewRequest = Partial<CreateSavedViewRequest>;