template-saas-backend-v2/src/modules/sales/dto/pipeline.dto.ts
Adrian Flores Cortes eb6a83daba feat(sales,commissions): Add Sales and Commissions backend modules
Sales Module (SAAS-018):
- Entities: PipelineStage, Lead, Opportunity, Activity
- Services: LeadsService, OpportunitiesService, ActivitiesService, PipelineService, SalesDashboardService
- Controllers: 25 endpoints for leads, opportunities, activities, pipeline, dashboard
- DTOs: Complete CRUD and query DTOs
- Integration with DDL functions: convert_lead_to_opportunity, update_opportunity_stage, calculate_lead_score

Commissions Module (SAAS-020):
- Entities: CommissionScheme, CommissionAssignment, CommissionPeriod, CommissionEntry
- Services: SchemesService, AssignmentsService, EntriesService, PeriodsService, CommissionsDashboardService
- Controllers: 25 endpoints for schemes, assignments, entries, periods, dashboard
- DTOs: Complete CRUD and query DTOs
- Integration with DDL functions: calculate_commission, close_period, get_user_earnings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:23:02 -06:00

86 lines
1.2 KiB
TypeScript

import {
IsString,
IsOptional,
IsInt,
IsBoolean,
MaxLength,
Min,
} from 'class-validator';
export class CreatePipelineStageDto {
@IsString()
@MaxLength(100)
name: string;
@IsInt()
@Min(0)
@IsOptional()
position?: number;
@IsString()
@MaxLength(7)
@IsOptional()
color?: string;
@IsBoolean()
@IsOptional()
isWon?: boolean;
@IsBoolean()
@IsOptional()
isLost?: boolean;
@IsBoolean()
@IsOptional()
isActive?: boolean;
}
export class UpdatePipelineStageDto {
@IsString()
@MaxLength(100)
@IsOptional()
name?: string;
@IsInt()
@Min(0)
@IsOptional()
position?: number;
@IsString()
@MaxLength(7)
@IsOptional()
color?: string;
@IsBoolean()
@IsOptional()
isWon?: boolean;
@IsBoolean()
@IsOptional()
isLost?: boolean;
@IsBoolean()
@IsOptional()
isActive?: boolean;
}
export class ReorderStagesDto {
@IsString({ each: true })
stageIds: string[];
}
export class PipelineStageResponseDto {
id: string;
tenantId: string;
name: string;
position: number;
color: string;
isWon: boolean;
isLost: boolean;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
opportunityCount?: number;
totalAmount?: number;
}