Add project board, loyalty club, and if/then automations.

Separate modules for post-sales kanban, person points/tiers, and deal-won/ticket-resolved rules without overlapping the sales pipeline.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-30 09:42:07 +03:30
co-authored by Cursor
parent 2e6c4779ab
commit c2bfa7749d
29 changed files with 3126 additions and 9 deletions
+97
View File
@@ -0,0 +1,97 @@
import { Type } from 'class-transformer';
import {
IsBoolean,
IsIn,
IsInt,
IsObject,
IsOptional,
IsString,
MaxLength,
Min,
MinLength,
ValidateIf,
} from 'class-validator';
const TRIGGERS = ['deal_won', 'ticket_resolved'] as const;
const ACTIONS = [
'create_activity',
'create_notification',
'add_loyalty_points',
] as const;
export class CreateAutomationRuleDto {
@IsString()
@MinLength(2)
@MaxLength(120)
name!: string;
@IsIn(TRIGGERS)
trigger!: (typeof TRIGGERS)[number];
@IsIn(ACTIONS)
action!: (typeof ACTIONS)[number];
@IsOptional()
@IsBoolean()
isActive?: boolean;
@IsOptional()
@IsObject()
config?: Record<string, unknown>;
}
export class UpdateAutomationRuleDto {
@IsOptional()
@IsString()
@MinLength(2)
@MaxLength(120)
name?: string;
@IsOptional()
@IsIn(TRIGGERS)
trigger?: (typeof TRIGGERS)[number];
@IsOptional()
@IsIn(ACTIONS)
action?: (typeof ACTIONS)[number];
@IsOptional()
@IsBoolean()
isActive?: boolean;
@IsOptional()
@IsObject()
config?: Record<string, unknown>;
}
export class AutomationConfigDto {
@IsOptional()
@IsString()
@MaxLength(200)
title?: string;
@IsOptional()
@IsString()
@MaxLength(1000)
body?: string;
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@IsString()
assigneeId?: string | null;
@IsOptional()
@ValidateIf((_, v) => v !== '' && v != null)
@IsString()
notifyUserId?: string | null;
@IsOptional()
@IsIn(['call', 'meeting', 'task', 'note'])
activityType?: string;
@IsOptional()
@Type(() => Number)
@IsInt()
@Min(1)
points?: number;
}