feat: باشگاه امتیازات کارکنان (موتور امتیاز، جدول رتبه، فروشگاه پاداش، نشان‌ها، پنل مدیریت و گزارش ROI)

- موتور رویدادمحور با شرط، محدودیت، تأیید مدیر و idempotency
- اتصال به لید، مشتری، معامله، فعالیت، روتین، پیش‌فاکتور، فاکتور و تیکت
- صفحه /club و /club/admin، اعلان زنده امتیاز، آیتم منو
- انتقال فرم‌ساز سرنخ به ابزارها

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-10 21:28:49 +03:30
co-authored by Cursor
parent b87ebb22e0
commit 60d797f184
51 changed files with 11298 additions and 806 deletions
+20
View File
@@ -23,6 +23,7 @@ import {
import { NotificationsService } from '../notifications/notifications.service';
import { AutomationsService } from '../automations/automations.service';
import { MessageAutomationsService } from '../message-automations/message-automations.service';
import { GamificationService } from '../gamification/gamification.service';
const include = {
person: { select: { id: true, firstName: true, lastName: true } },
@@ -45,6 +46,7 @@ export class TicketsService {
private readonly notifications: NotificationsService,
private readonly automations: AutomationsService,
private readonly messageAutomations: MessageAutomationsService,
private readonly game: GamificationService,
) {}
async list(
@@ -200,6 +202,15 @@ export class TicketsService {
};
await this.automations.runTrigger('ticket_created', createdCtx);
await this.messageAutomations.onEvent('ticket_created', createdCtx);
this.game.emit({
organizationId: actor.organizationId,
userId: actor.userId,
event: 'TICKET_CREATED',
entityType: 'ticket',
entityId: row.id,
entityTitle: row.subject,
facts: { priority: row.priority },
});
return this.toDto(row);
}
@@ -319,6 +330,15 @@ export class TicketsService {
};
await this.automations.runTrigger('ticket_resolved', resolvedCtx);
await this.messageAutomations.onEvent('ticket_resolved', resolvedCtx);
this.game.emit({
organizationId: actor.organizationId,
userId: (data.assigneeId as string | null | undefined) ?? existing.assigneeId ?? actor.userId,
event: 'TICKET_RESOLVED',
entityType: 'ticket',
entityId: existing.id,
entityTitle: existing.subject,
facts: { priority: (dto.priority ?? existing.priority) as string },
});
}
return this.get(actor, id);