Commit Graph

47 Commits

Author SHA1 Message Date
Adrian Flores Cortes
7f32ee65b6 [ST-P2-001] feat: Add DTOs for Construction, Finance, and HSE modules
- Construction: 6 DTOs (create/update/response proyecto, fraccionamiento)
- Finance: 5 DTOs (create/update/response bank-account, accounting-entry)
- HSE: 7 DTOs (incidente, capacitacion, permiso-trabajo, epp-asignacion)

All DTOs use class-validator for validation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 07:38:54 -06:00
Adrian Flores Cortes
06c48678b1 [ST-P0-001] feat: Add User entity and fix auth relationships
- Create user.entity.ts with all fields from erp-core
- Update index.ts to export User and UserStatus
- Add bidirectional ManyToMany relationship in role.entity.ts
- Add bidirectional ManyToMany relationship in company.entity.ts
- Fix session.entity.ts import to use local user.entity
- Fix password-reset.entity.ts import to use local user.entity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 07:19:38 -06:00
Adrian Flores Cortes
99fadef0ba [SPRINT-2] feat: Complete Quality module controllers
- Add non-conformity.controller.ts with CRUD endpoints
- Add corrective-action.controller.ts with workflow management
- Add protocolo-calidad.controller.ts for quality protocols
- Update inspection.controller.ts and exports index

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 07:05:18 -06:00
Adrian Flores Cortes
164186cec6 [CONST-D-002] feat: Add dashboard API endpoints to reports controller
- GET /reports/dashboard/stats - Dashboard aggregate statistics
- GET /reports/projects/summary - Projects summary with EVM KPIs
- GET /reports/projects/:id/kpis - Project KPIs
- GET /reports/projects/:id/earned-value - EVM metrics
- GET /reports/projects/:id/s-curve - S-curve data
- GET /reports/alerts - Active alerts
- PATCH /reports/alerts/:id/acknowledge|resolve

Integrates EarnedValueService for EVM calculations.
Build: PASSED

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 04:30:48 -06:00
Adrian Flores Cortes
caf9d4f0cb [SPRINT-0] fix: Resolve all 72 TypeScript compilation errors
- billing-usage: Remove unused imports, fix UpdateCouponDto access
- biometrics: Remove unused imports, fix duplicate exports in index.ts
- invoices: Fix undefined vs null type mismatches with ?? null
- partners: Fix duplicate ServiceContext exports, type mismatches
- projects: Remove unused imports
- shared/middleware: Fix TokenPayload type access

Build now passes: npm run build = 0 errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 02:31:34 -06:00
Adrian Flores Cortes
450b13edff feat(progress): Add ProgramaObraService for work schedule management
Sprint 2 - S2-T01 backend support

New service with methods:
- createPrograma: Create new work schedule with auto-generated code
- findAll/findById: List and get programas with actividades
- updatePrograma: Update programa details
- createVersion: Create new version for reprogramming
- addActividad/updateActividad/removeActividad: Activity management
- reorderActividades: Reorder with WBS code regeneration
- getGanttData: Data formatted for Gantt chart
- getSCurveData: Planned vs actual progress curves

DTOs: CreateProgramaDto, UpdateProgramaDto, CreateActividadDto, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 00:21:23 -06:00
Adrian Flores Cortes
b67a035119 [RBAC-005] feat: Propagate RBAC middleware from erp-core
- Add rbac.middleware.ts with requirePerm, requireAnyPerm, requireAllPerms, requireAccess, requirePermOrOwner
- Add permission-cache.service.ts for Redis caching
- Update shared services and middleware index exports
- Configure construction-specific roles (manager, admin, super_admin)

Propagated from erp-core TASK-2026-01-30-RBAC

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 14:58:06 -06:00
Adrian Flores Cortes
100c5a6588 feat(modules): implement 13 backend modules for 100% completion
Implemented modules:
- audit: 8 services (GDPR compliance, retention policies, sensitive data)
- billing-usage: 8 services, 6 controllers (subscription management, usage tracking)
- biometrics: 3 services, 3 controllers (offline auth, device sync, lockout)
- core: 6 services (sequence, currency, UoM, payment-terms, geography)
- feature-flags: 3 services, 3 controllers (rollout strategies, A/B testing)
- fiscal: 7 services, 7 controllers (SAT/Mexican tax compliance)
- mobile: 4 services, 4 controllers (offline-first, sync queue, device management)
- partners: 6 services, 6 controllers (unified customers/suppliers, credit limits)
- profiles: 5 services, 3 controllers (avatar upload, preferences, completion)
- warehouses: 3 services, 3 controllers (zones, hierarchical locations)
- webhooks: 5 services, 5 controllers (HMAC signatures, retry logic)
- whatsapp: 5 services, 5 controllers (business API integration, templates)

Total: 154 files, ~43K lines of new backend code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 01:54:23 -06:00
Adrian Flores Cortes
22b8e93d55 feat(settings): Add services and controllers for settings module
- SystemSettingService: Global system-wide settings with CRUD, get/set by key,
  validation rules, and bulk operations
- PlanSettingService: Plan-level defaults with inheritance support and
  copy between plans functionality
- TenantSettingService: Tenant-specific settings with hierarchy
  (system < plan < tenant), effective value resolution, and override management
- UserPreferenceService: Personal preferences with defaults, sync support,
  and cross-user operations
- SettingsController: Unified REST endpoints for all settings types with
  proper authentication and authorization

Implements hierarchical inheritance: system_settings < plan_settings <
tenant_settings < user_preferences. All services follow ServiceContext
pattern with tenantId for multi-tenant support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 01:44:26 -06:00
Adrian Flores Cortes
8f8843cd10 [ERP-CONSTRUCCION] feat: Implement 6 core business modules
Branches:
- 5 services: branch, schedule, inventory-settings, payment-terminal, user-assignment
- Hierarchical management, schedules, terminals

Products:
- 6 services: category, product, price, supplier, attribute, variant
- Hierarchical categories, multi-pricing, variants

Projects:
- 6 services: project, task, timesheet, milestone, member, stage
- Kanban support, timesheet approval workflow

Sales:
- 2 services: quotation, sales-order
- Full sales workflow with quotation-to-order conversion

Invoices:
- 2 services: invoice, payment
- Complete invoicing with payment allocation

Notifications:
- 5 services: notification, preference, template, channel, in-app
- Multi-channel support (email, sms, push, whatsapp, in-app)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 00:24:00 -06:00
Adrian Flores Cortes
88e1c4e9b6 [ERP-CONSTRUCCION] feat(hse): Add 14 services for safety, training, and environmental management
Safety:
- dias-sin-accidente.service: Days without accidents counter
- hallazgo.service: Safety findings with workflow
- programa-seguridad.service: Annual safety programs

Training:
- instructor.service: Training instructors management
- sesion-capacitacion.service: Training sessions and attendance
- constancia-dc3.service: DC-3 certificates (STPS)
- cumplimiento.service: Regulatory compliance tracking
- comision-seguridad.service: Safety commissions (NOM-019)
- horas-trabajadas.service: Work hours for safety indices

Environmental:
- residuo-peligroso.service: Hazardous waste management
- almacen-temporal.service: Temporary storage facilities
- proveedor-ambiental.service: Environmental providers
- auditoria-ambiental.service: Environmental audits
- reporte-programado.service: Scheduled HSE reports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:33:51 -06:00
Adrian Flores Cortes
e5f63495e8 feat(quality): Add missing services for quality module
Implement four new services for the quality module (MAI-009):
- CorrectiveActionService: CAPA (Corrective and Preventive Actions)
  workflow with create, start, complete, verify, and reopen operations
- NonConformityService: NC lifecycle management with severity-based
  SLA, contractor assignment, and status workflow
- InspectionResultService: Recording and batch recording of inspection
  results with summary statistics
- TicketAssignmentService: Ticket assignment, reassignment, scheduling,
  and technician workload tracking

All services follow the ServiceContext pattern with tenantId.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:27:35 -06:00
Adrian Flores Cortes
6a64edf4c8 feat(inventory): Add AlmacenProyectoService for project warehouse management
Implements missing service for project-specific warehouse assignments:
- CRUD operations for project warehouse assignments
- Stock queries by project (fraccionamiento)
- Transfer between project warehouses with transaction support
- Project inventory summary with stock value calculations
- Integration with ERP Core inventory tables

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:25:17 -06:00
Adrian Flores Cortes
3b4bb3d80e [ERP-CONSTRUCCION] feat: Enhance budgets and estimates services
Budgets:
- concepto.service: Add bulk operations, tree navigation, catalog stats
- presupuesto.service: Add version comparison, search, duplicate, summary

Estimates:
- estimacion.service: Add cumulative totals, document generation, workflow
- deductiva.service: New service for penalty/deduction management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:16:51 -06:00
Adrian Flores Cortes
19fcf169c0 feat(contracts): Enhance contract and subcontractor services
Added contract partidas (items) management to ContractService:
- getPartidas: Retrieve all partidas for a contract
- addPartida: Add new partida to draft/review contracts
- updatePartida: Update quantity/price of existing partida
- removePartida: Soft delete partida from contract
- recalculateContractAmount: Recalculate contract total from partidas

Enhanced SubcontractorService with additional methods:
- reactivate: Reactivate inactive subcontractors (blocks blacklisted)
- getTopRated: Get top-rated active subcontractors
- getStatistics: Get aggregate statistics (totals, ratings)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 18:12:46 -06:00
Adrian Flores Cortes
6a71183121 feat(MAI-002,MAI-004,MAI-009): Add missing controllers and services
- construction/torre: Service + Controller for vertical buildings
- construction/nivel: Service + Controller for floor levels
- construction/departamento: Service + Controller for units
- purchase/purchase-order-construction: Controller for PO extensions
- purchase/supplier-construction: Controller for supplier extensions
- quality/checklist: Controller for inspection templates

All endpoints follow existing patterns with multi-tenancy support.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:39:51 -06:00
Adrian Flores Cortes
6d84520811 feat(MAI-002): Add Torre, Nivel, Departamento entities for vertical structures
- Add torre.entity.ts for construction.torres table
- Add nivel.entity.ts for construction.niveles table
- Add departamento.entity.ts for construction.departamentos table
- Update etapa.entity.ts with OneToMany Torre relation
- Update avance-obra.entity.ts with ManyToOne Lote/Departamento relations
- Update entities index.ts with new exports

Completes vertical structure entities matching DDL schema.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:06:05 -06:00
Adrian Flores Cortes
598c3215e1 feat(FASE-4A): Complete vertical modules for construction
- MAI-018 Bidding module: entities, services, controllers, DTOs
  - Opportunity, Tender, Proposal, Vendor management
  - Bid calendar, documents, analytics
- Earned Value Management: Curva S, SPI/CPI reports
  - earned-value.service.ts with EV, PV, AC calculations
  - earned-value.controller.ts with 9 endpoints
- DTOs for modules: assets, contracts, documents, purchase, quality
  - 28 new DTO files with class-validator decorators
- Storage module: service and controller implementation
  - Multi-provider support (local, S3, GCS, Azure)
  - File management, upload/download URLs
- Multiple entity and service fixes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 07:00:18 -06:00
Adrian Flores Cortes
c8a01c5f14 fix(hr): Fix PaginatedResult format in employee and puesto services
- Remove meta wrapper from PaginatedResult returns in findWithFilters and findAll
- Return flat format with total, page, limit, totalPages at top level
- Align with base.service.ts interface definition
- Controllers already updated to access flat pagination structure
2026-01-25 14:52:53 -06:00
Adrian Flores Cortes
873693b1d1 fix(reports): Add type annotation for 's' parameter in kpi.service.ts map callback
Parameter 's' in the categoryStats.map() callback on line 404 was implicitly typed as 'any', causing TS7006 error. Added explicit 'any' type annotation to resolve the TypeScript compilation error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:44:37 -06:00
Adrian Flores Cortes
bd6dd271c2 [TS-FIX] fix: Fix TypeScript errors in finance services
- Fix entity property mismatches in ar.service.ts (customerId vs partnerId, balance vs balanceAmount)
- Fix entity property mismatches in ap.service.ts (supplierId vs partnerId, balance vs balanceAmount)
- Fix entity property mismatches in cash-flow.service.ts
- Fix entity property mismatches in erp-integration.service.ts (currency, sapCode, description)
- Fix unused imports and dataSource declarations in all finance services
- Error count: 410 -> 346

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:34:49 -06:00
Adrian Flores Cortes
cf23727b2b refactor: Clean up finance services (AP, AR, cash-flow, bank-reconciliation)
- Cleaned up ap.service.ts
- Refactored ar.service.ts
- Minor fixes in bank-reconciliation.service.ts
- Updated cash-flow.service.ts
- Cleaned erp-integration.service.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:31:51 -06:00
Adrian Flores Cortes
369f461695 [TS-FIX] fix: Fix TS7030 errors in finance controllers
- Add Promise<void> return type to async handlers with conditional returns
- Change 'return res.status()' to 'res.status(); return;' pattern
- Fixed controllers: ap, ar, bank-reconciliation, cash-flow, reports, accounting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:21:33 -06:00
Adrian Flores Cortes
5775585a98 fix: Update AP and AR controllers
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:16:43 -06:00
Adrian Flores Cortes
494a5f2306 fix: Update finance controllers
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:14:19 -06:00
Adrian Flores Cortes
61c61e4c2f [TS-FIX] fix: Fix TypeScript errors in finance module services
- Fix PaginatedResult to use flat format instead of meta wrapper
- Replace debitAmount/creditAmount with debit/credit (entity property names)
- Replace currencyCode with currency on AccountingEntry
- Replace partnerId/partnerName with supplierId/supplierName on AccountPayable
- Replace balanceAmount with balance on AccountPayable
- Replace reversalEntryId with reversedEntryId
- Replace acceptsMovements with allowsDirectPosting on ChartOfAccounts
- Fix APPayment properties: amount, currency, remove non-existent properties
- Remove unused imports (Between, In, LessThan, PaymentStatus)
- Fix unused dataSource parameter in constructors

Errors reduced from 507 to 443 (13% reduction in this commit)
Total reduction from initial ~730: 287 errors (39%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:38:46 -06:00
Adrian Flores Cortes
a36a44d5e7 [TS-FIX] fix: Fix TypeScript errors in ai and budgets modules
AI module:
- Remove unused imports (DataSource, ERP_ROLES, LessThan, MoreThanOrEqual)
- Fix AIUsageLog properties (promptTokens, completionTokens)
- Fix AIModel property (modelId, inputCostPer1k)
- Add types to API response parsing

Budgets module (partial):
- Convert ConceptoService from extends BaseService to standalone
- Fix concepto.controller pagination format

Remaining: presupuesto.service needs conversion to standalone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:19:18 -06:00
Adrian Flores Cortes
78c30d315d [TS-FIX] fix: Fix TypeScript errors in ai module
- Remove unused imports (DataSource, ERP_ROLES, LessThan, MoreThanOrEqual)
- Fix AIUsageLog properties (promptTokens, completionTokens instead of inputTokens, outputTokens)
- Fix AIModel property (modelId instead of externalId, inputCostPer1k instead of inputCostPer1m)
- Add types to API response parsing
- Prefix unused parameters with underscore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:17:00 -06:00
Adrian Flores Cortes
99064f5f24 [TS-FIX] fix: Fix TypeScript errors in admin and bidding modules
- Add ServiceContext interface to base.service.ts
- Fix admin module: audit-log, backup, cost-center, system-setting
  - Define ServiceContext and PaginatedResult locally
  - Convert services from extends BaseService to standalone
  - Change PaginatedResult from meta format to flat format
  - Fix controllers to use flat pagination format
- Fix bidding module: bid, bid-budget, opportunity
  - Change PaginatedResult from meta format to flat format
  - Fix controllers to use flat pagination format

Modules with remaining errors: finance, payment-terminals, estimates,
mcp, reports, progress, budgets, ai, hse (563 errors total)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:10:00 -06:00
Adrian Flores Cortes
f14829d2ce [MAE-015] fix: Fix TypeScript errors in assets module
- Fix controllers to use Promise<void> return types
- Replace 'return res.status()' with 'res.status(); return;'
- Add NextFunction parameter to handlers
- Fix enum-style references with string literals
- Replace 'deletedAt: null' with 'IsNull()' for TypeORM
- Remove unused parameters and imports
- Fix grouped object initialization in getByStatus
- Remove non-existent 'updatedBy' property from WorkOrderPart

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:51:01 -06:00
Adrian Flores Cortes
e441e9c626 [MAE-016] feat: Complete documents module with REST controller
- Convert services from NestJS to Express pattern
- Remove unused ServiceContext interfaces
- Add DocumentController with full CRUD endpoints:
  - GET /documents (list with filters)
  - GET /documents/:id (get by ID)
  - GET /documents/statistics
  - GET /documents/generate-code
  - GET /documents/project/:projectId
  - GET /documents/:id/access-history
  - GET /documents/:id/versions
  - GET /documents/:id/versions/statistics
  - POST /documents (create)
  - POST /documents/:id/versions (create version)
  - POST /documents/:id/status (change status)
  - POST /documents/:id/lock
  - POST /documents/:id/unlock
  - POST /documents/versions/:versionId/set-current
  - POST /documents/versions/:versionId/archive
  - PUT /documents/:id (update)
  - DELETE /documents/:id (soft delete)
- Add controllers/index.ts export

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:31:21 -06:00
Adrian Flores Cortes
24c2931209 [MAI-012] feat: Complete contracts module with schema fixes
- Fix 3 entities schema from 'contracts' to 'construction' to match DDL
- Create ContractPartida entity for contrato_partidas table
- Fix ContractService and SubcontractorService to use local ServiceContext
- Fix ContractController and SubcontractorController pagination structure
- Update entities/index.ts to export ContractPartida

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 09:08:31 -06:00
Adrian Flores Cortes
60782a3cac [MAI-009] feat: Complete quality module with schema fixes and ChecklistService
- Fix 8 entities schema from 'quality' to 'construction' to match DDL
- Create ChecklistService with full CRUD, duplication, item management
- Fix InspectionService and TicketService to use local ServiceContext
- Fix InspectionController and TicketController pagination structure
- Update services/index.ts to export ChecklistService

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:54:18 -06:00
Adrian Flores Cortes
63013bb2f4 [MAI-004] feat(purchase): Add construction extensions for purchase orders and suppliers
- Add PurchaseOrderConstruction entity for delivery and quality tracking
- Add SupplierConstruction entity for ratings, specialties and credit terms
- Add PurchaseOrderConstructionService with reception and quality workflows
- Add SupplierConstructionService with evaluation and statistics features
- Update entities and services index files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:40:36 -06:00
Adrian Flores Cortes
22b9692e3a [MAE-016] feat: Add Documents module (Gestion Documental)
- Create 11 entities matching DDL:
  - DocumentCategory: Hierarchical categories
  - Document: Main document registry
  - DocumentVersion: Version control with files
  - DocumentPermission: Granular permissions
  - ApprovalWorkflow: Workflow definitions
  - ApprovalInstance: Active workflow instances
  - ApprovalStep: Steps per instance
  - ApprovalActionEntity: Actions taken
  - Annotation: Comments and markups
  - AccessLog: Access history
  - DocumentShare: External sharing links
- Create DocumentService with full CRUD
- Create DocumentVersionService for version management
- All entities follow ERP-Construction patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 08:22:49 -06:00
Adrian Flores Cortes
881e7e40f2 [SYNC] Synchronize payment-terminals module from erp-core canonical
Source: erp-core (checksum: c9040e545cf55beb87d3e437a4998855)
Priority: P1 - HIGH
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version (one of 3 different versions)
After: Synced with canonical

Changes:
- Complete payment-terminals module synchronized from erp-core
- 21 TypeScript files updated
- Unified payment terminal integration (MercadoPago + Clip)
- Consistent webhook handling across all ERP projects

Benefits:
- Single source of truth for payment terminals functionality
- Consistent TPV integration behavior
- Reduced maintenance burden (~4,000 lines saved)
- Unified webhook processing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:52:08 -06:00
Adrian Flores Cortes
c3200bc53e [SYNC] BaseService synchronized from erp-core canonical
Source: erp-core (checksum: 900be2ee48f2faf72ce5253aeab27c88)
Priority: P1 - HIGH (architectural gap resolution)
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: "Diverged version"
After: Synced with canonical

Changes:
- BaseService "synchronized" from erp-core
- Checksum: 900be2ee48f2faf72ce5253aeab27c88
- Provides base CRUD operations for all services

Benefits:
- Unified service architecture
- Consistent error handling and validation
- Reduced code duplication in service implementations
- Standard pagination and filtering patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:43:25 -06:00
Adrian Flores Cortes
49f9359b0b [SYNC] Synchronize ai module from erp-core canonical
Source: erp-core (checksum: 39a6e229055a21158b63cc4eb4dd232f)
Priority: P0 - CRITICAL divergence resolution
Context: TASK-2026-01-25-SISTEMA-REUTILIZACION

Before: Diverged version with project-specific adaptations
After: Synced with canonical

Changes:
- Complete ai module synchronized from erp-core
- 24 TypeScript files updated
- Unified role-based AI configuration
- Consistent AI behavior across all ERP projects

Note: Project-specific role adaptations (if needed) can be
re-applied as documented extensions after this sync.

Benefits:
- Single source of truth for AI functionality
- Reduced maintenance burden
- Token savings from code reuse
- Consistent behavior baseline

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 06:36:11 -06:00
Adrian Flores Cortes
5f9c30d268 [MAE-015] feat: Implement assets module backend
Complete implementation of the Assets/Machinery/Maintenance module:

Entities (10):
- AssetCategory: Hierarchical asset categorization with depreciation config
- Asset: Main asset entity (machinery, vehicles, tools, equipment)
- AssetAssignment: Asset-to-project assignments tracking
- WorkOrder: Maintenance work orders with workflow
- WorkOrderPart: Parts/materials used in work orders
- MaintenancePlan: Preventive maintenance plans
- MaintenanceHistory: Historical maintenance records
- FuelLog: Fuel consumption tracking with efficiency calculation
- AssetCost: TCO (Total Cost of Ownership) tracking

Services (3):
- AssetService: CRUD, assignments, categories, statistics
- WorkOrderService: CRUD, workflow (start/hold/resume/complete/cancel), parts
- FuelLogService: CRUD, efficiency calculation, statistics

Controllers (3):
- AssetController: REST API for assets, assignments, categories
- WorkOrderController: REST API for work orders, workflow, plans
- FuelLogController: REST API for fuel logs, statistics

Features:
- Multi-tenant support with tenant_id
- Complete workflow for work orders (draft→scheduled→in_progress→completed)
- Automatic efficiency calculation for fuel consumption
- Asset assignment history tracking
- Maintenance plan generation
- TCO tracking by cost type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 05:41:54 -06:00
Adrian Flores Cortes
bdf8c878e8 [PROP-CORE-004] feat: Register payment-terminals module in app
- Added PaymentTerminalsModule import and initialization
- Registered routes: /api/v1/payment-terminals, /api/v1/mercadopago, /api/v1/clip
- Registered webhooks: /webhooks/mercadopago, /webhooks/clip
- Updated API info with new endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:13:46 -06:00
Adrian Flores Cortes
3f54669dde [PROP-CORE-004] fix: Remove external entity references from payment-terminals
Fixed getEntities() to only reference own entities, avoiding require errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 03:08:24 -06:00
Adrian Flores Cortes
058f42a4d1 [PROP-CORE-004] feat: Adapt AI roles for construction domain
- Roles: ADMIN, SUPERVISOR_OBRA, RESIDENTE, ALMACENISTA
- Domain-specific tools (projects, progress, materials)
- Construction industry terminology

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:57:45 -06:00
Adrian Flores Cortes
0493d4b8bd [PROP-CORE-004] feat: Add Phase 6 modules from erp-core
Propagated modules:
- payment-terminals: MercadoPago + Clip TPV
- ai: Role-based AI access (ADMIN, SUPERVISOR_OBRA, RESIDENTE, ALMACENISTA)
- mcp: 18 ERP tools for AI assistants

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 02:45:03 -06:00
Adrian Flores Cortes
9a3f43ed2e chore: Update package-lock.json 2026-01-25 02:27:58 -06:00
81b847ce8a chore: Add .gitignore for clean repository
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:31:35 -06:00
7c1480a819 Migración desde erp-construccion/backend - Estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:11:14 -06:00
aeb201d7f6 Initial commit 2026-01-16 14:04:08 +00:00