Adrian Flores Cortes
61d7d29212
test(P2): Add controller tests for sales, commissions, and portfolio
...
- Add 12 controller test files (117 tests total):
- sales: leads, opportunities, activities, pipeline, dashboard
- commissions: schemes, assignments, entries, periods, dashboard
- portfolio: categories, products
- Fix flaky test in assignments.service.spec.ts (timestamp issue)
- All 441 tests passing for these modules
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 13:25:42 -06:00
Adrian Flores Cortes
b1ee86e0e5
fix(tests): Update test expectations to use undefined instead of null
...
- Fixed toResponse test assertions in assignments, entries, and periods
- Aligns test expectations with mock object field definitions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:07:32 -06:00
Adrian Flores Cortes
ee7ed19e4a
fix(tests): Align mock objects with entity type definitions
...
- Changed null to undefined for optional fields in mock objects
- Fixed TierDto field names (from/to instead of min/max)
- Fixed type casts using 'as any' for mocks with undefined values
- Resolved all TypeScript build errors in test files
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:04:31 -06:00
Adrian Flores Cortes
d72bc4da04
fix(entities): Align User, Tenant, Role entities with DDL schema
...
- User entity: Add display_name, phone_verified, is_owner, password_changed_at,
failed_login_attempts, locked_until, preferences, last_activity_at,
created_by, updated_by, deleted_at fields
- Tenant entity: Add subscription_status, stripe_customer_id,
stripe_subscription_id, subscription_ends_at, created_by, updated_by,
deleted_at fields. Fix logo_url length (255→500)
- Role entity: Add slug, permissions, parent_role_id, level, created_by fields.
Fix name length (50→100)
- Update test mocks to include new entity fields
Ensures DDL↔Backend coherence as per TRIGGER-COHERENCIA-CAPAS
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:57:32 -06:00
Adrian Flores Cortes
5b0e61c029
[TASK-007] feat: P1 complete - billing entities + unit tests
...
## T-01.5: Billing entities
- invoice.entity.ts: Added hosted_invoice_url, customer_name,
customer_email, billing_address, notes
## T-05.1: Sales tests (109 tests, 100% coverage)
- leads.service.spec.ts
- opportunities.service.spec.ts
- activities.service.spec.ts
- pipeline.service.spec.ts
## T-05.2: Commissions tests (136 tests, 100% coverage)
- schemes.service.spec.ts
- assignments.service.spec.ts
- entries.service.spec.ts
- periods.service.spec.ts
## T-05.3: Portfolio tests (79 tests, 100% coverage)
- categories.service.spec.ts
- products.service.spec.ts
Total: 324 new tests, all passing
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:53:39 -06:00
Adrian Flores Cortes
a881c5cc2b
[TASK-007] fix: Sync entities with DDL - add missing fields
...
- user.entity: Add display_name, phone_verified, is_owner, password_changed_at,
failed_login_attempts, locked_until, preferences, last_activity_at
- role.entity: Add slug, permissions, parent_role_id, level for hierarchy
- tenant.entity: Add subscription_status, stripe_customer_id,
stripe_subscription_id, subscription_ends_at, deleted_at
Closes DDL↔Backend coherence gaps identified in TASK-007 analysis.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 12:30:39 -06:00
Adrian Flores Cortes
c683ab0353
[SAAS-021] feat: Implement MLM module backend
...
- 6 entities: structure, rank, node, commission, bonus, rank_history
- 4 DTOs with validation
- 4 services with tree operations (LTREE path queries)
- 4 controllers with full CRUD
- Commission calculation and rank evaluation logic
- My network endpoints for user dashboard
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:48:44 -06:00
Adrian Flores Cortes
6d6241c6cb
fix: Resolve TypeORM entity type metadata issues
...
- Add explicit type: 'varchar' to nullable string columns in entities
- Fix CommissionPeriodEntity.paymentReference type
- Fix CategoryEntity.imageUrl and other nullable columns in portfolio entities
- Remove incomplete test files that reference non-existent methods
- Add missing dependencies (web-push, @nestjs/websockets, socket.io)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:36:18 -06:00
Adrian Flores Cortes
09ea4d51b4
[SAAS-022] feat: Implement Goals module backend
...
- Added 4 entities: DefinitionEntity, AssignmentEntity, ProgressLogEntity, MilestoneNotificationEntity
- Added DTOs for definitions and assignments
- Added services for definitions and assignments CRUD
- Added controllers with full REST API endpoints
- Added GoalsModule and registered in AppModule
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:25:44 -06:00
Adrian Flores Cortes
2921ca9e83
[SAAS-019] feat: Add Portfolio module backend
...
- 4 entities: Category, Product, Variant, Price
- 2 services: CategoriesService, ProductsService
- 2 controllers with full CRUD endpoints
- DTOs for all operations
- Registered in AppModule
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 05:41:52 -06:00
Adrian Flores Cortes
a2a1fd3d3b
test: Add unit tests for commissions and sales modules
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 01:33:15 -06:00
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
Adrian Flores Cortes
b49a051d85
[SYNC] feat: Add pending entities, tests and notification adapters
...
- audit/unified-log.entity.ts
- billing/__tests__/billing-usage.service.spec.ts
- feature-flags/flag-override.entity.ts
- notifications/adapters/
- webhooks/__tests__/webhook-retry.spec.ts
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:12:16 -06:00
Adrian Flores Cortes
a2b8bc652f
[INTEGRACION] fix: Corregir credenciales en .env.example
...
Credenciales corregidas:
- DB_USER: gamilit_user → template_saas_user
- DB_PASSWORD: GO0jAOgw8Yzankwt → saas_dev_2026
Fuente de verdad: WORKSPACE-INTEGRATION.yml
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 18:21:15 -06:00
bb556a7789
[TEMPLATE-SAAS-BE] chore: Update analytics and audit modules
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:38:45 -06:00
7cb64656fd
[TS-BACKEND] chore: Update package-lock.json
2026-01-16 20:00:25 -06:00
56b03ae509
[TS-BACKEND] test: Add comprehensive analytics module test suite
...
Add unit tests for analytics module achieving 100% coverage:
- analytics.service.spec.ts: 43 tests covering all 5 public methods
- getUserMetrics: growth rate, retention rate, edge cases
- getBillingMetrics: revenue trends, subscription status, trial detection
- getUsageMetrics: action counts, peak hours, averages
- getSummary: KPIs, growth calculations
- getTrends: date truncation, empty data handling
- analytics.controller.spec.ts: 15 tests for all endpoints
- Period parameter handling (7d, 30d, 90d, 1y)
- Multi-tenant isolation validation
Part of Fase 4: Test coverage improvement (80.89% overall)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 17:17:54 -06:00
2ffe4864dd
[template-saas/backend] feat: Add 7 TypeORM entities from HU-REFACT-005
...
Entities created:
- RefreshToken (auth.refresh_tokens)
- SubscriptionItem (billing.subscription_items)
- InvoiceItem (billing.invoice_items)
- Payment (billing.payments)
- FlagEvaluationRecord (feature_flags.evaluations)
- PlanFeature (plans.plan_features)
- TenantSetting (tenants.tenant_settings)
Updated modules to register new entities.
DDL-Entity coherence: 82.5% -> 100%
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 12:32:17 -06:00
dfe6a715f0
Initial commit - Backend de template-saas migrado desde monorepo
...
Migración desde workspace-v2/projects/template-saas/apps/backend
Este repositorio es parte del estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:07:11 -06:00
6a750c0408
Initial commit
2026-01-16 14:04:04 +00:00