Commit Graph

95 Commits

Author SHA1 Message Date
Consultoria AS
56e6e27ab3 feat(sat): add SAT authentication and download services (Phase 3)
- Add sat-auth.service.ts for SAML token authentication with SAT
  using FIEL credentials and SOAP protocol
- Add sat-download.service.ts with full download workflow:
  - Request CFDI download (emitted/received)
  - Verify request status with polling support
  - Download ZIP packages when ready
  - Helper functions for status checking
- Install fast-xml-parser and adm-zip dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:49:02 +00:00
Consultoria AS
a64aa11548 feat(sat): add FIEL management and encryption services (Phase 2)
- Add sat-crypto.service.ts with AES-256-GCM encryption for secure
  credential storage using JWT_SECRET as key derivation source
- Add fiel.service.ts with complete FIEL lifecycle management:
  - Upload and validate FIEL credentials (.cer/.key files)
  - Verify certificate is FIEL (not CSD) and not expired
  - Store encrypted credentials in database
  - Retrieve and decrypt credentials for SAT sync operations
- Install @nodecfdi/credentials for FIEL/CSD handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:44:04 +00:00
Consultoria AS
787aac9a4c feat(sat): add database models for SAT sync
Phase 1 - Database models:
- Add FielCredential model for encrypted FIEL storage
- Add SatSyncJob model for sync job tracking
- Add SAT-related enums (SatSyncType, SatSyncStatus, CfdiSyncType)
- Add TypeScript types in shared package
- Relations: Tenant -> FielCredential (1:1), Tenant -> SatSyncJobs (1:N)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:38:51 +00:00
Consultoria AS
3763014eca docs: add SAT sync implementation plan
Detailed implementation plan with 9 phases:
1. Database models and migrations
2. Cryptography and FIEL services
3. SAT communication services
4. CFDI XML parser
5. Main orchestrator service
6. Scheduled cron job
7. API endpoints
8. Frontend components
9. Testing and validation

Includes:
- 16 new files to create
- 5 files to modify
- Dependencies list
- Implementation order

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:36:53 +00:00
Consultoria AS
b49902bcff docs: add SAT sync feature design
Design document for automatic CFDI synchronization with SAT:
- FIEL (e.firma) authentication
- Download emitted and received CFDIs
- Daily automated sync at 3:00 AM
- Initial extraction of last 10 years
- Encrypted credential storage (AES-256-GCM)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:35:12 +00:00
Consultoria AS
519de61c6f chore: add systemd service files for auto-start
Add systemd unit files for automatic service startup:
- horux-api.service: API server on port 4000
- horux-web.service: Web frontend on port 3000

Services are configured to:
- Start automatically on boot
- Restart on failure
- Depend on PostgreSQL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 00:17:47 +00:00
Consultoria AS
4fd6f01303 feat: add company logo and configure Cloudflare tunnel support
- Add company logo to login page and all sidebar variants
- Configure Next.js rewrites to proxy /api/* to backend
- Enable external access via Cloudflare Zero Trust tunnel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:32:21 +00:00
Consultoria AS
7454cf67e6 chore: increase max upload size to 1GB
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:09:03 +00:00
Consultoria AS
db1f2eaecd perf: optimize bulk XML upload for 100k+ files
Backend:
- Add batch insert using multi-row INSERT with ON CONFLICT
- Process in batches of 500 records for optimal DB performance
- Return detailed batch results (inserted, duplicates, errors)

Frontend:
- Parse files in chunks of 500 to prevent memory issues
- Upload in batches of 200 CFDIs per request
- Add detailed progress bar with real-time stats
- Show upload statistics (loaded, duplicates, errors)
- Add cancel functionality during upload
- Refresh data after upload completes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 07:01:04 +00:00
Consultoria AS
c3ce7199af feat: bulk XML upload, period selector, and session persistence
- Add bulk XML CFDI upload support (up to 300MB)
- Add period selector component for month/year navigation
- Fix session persistence on page refresh (Zustand hydration)
- Fix income/expense classification based on tenant RFC
- Fix IVA calculation from XML (correct Impuestos element)
- Add error handling to reportes page
- Support multiple CORS origins
- Update reportes service with proper Decimal/BigInt handling
- Add RFC to tenant view store for proper CFDI classification
- Update README with changelog and new features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 06:51:53 +00:00
Consultoria AS
0c10c887d2 feat: add multi-tenant client management for admins
- Add tenants API endpoints (list, get, create)
- Add tenant middleware override via X-View-Tenant header
- Add TenantSelector dropdown component in header
- Add tenant view store with persistence
- Add Clientes management page
- Update all navigation layouts with Clientes link for admins

Admins can now:
- View list of all clients
- Create new clients with automatic schema setup
- Switch between viewing different clients' data
- See which client they are currently viewing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:55:44 +00:00
Consultoria AS
6e3e69005b feat: add theme-based layouts
Each theme now has a unique layout:
- Light: Standard fixed sidebar
- Vibrant: Horizontal top navigation
- Corporate: Compact sidebar (expands on hover)
- Dark: Floating sidebar with glass effect

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:46:02 +00:00
Consultoria AS
74b1bb8c02 fix: add missing UI components and utilities
- Add tabs.tsx component
- Add select.tsx component
- Add formatCurrency utility function
- Export new components from index

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:40:03 +00:00
Consultoria AS
f4b42aa8c2 fix: add missing errors utility and fix seed timestamp casting
- Add apps/api/src/utils/errors.ts with AppError class
- Fix seed.ts timestamp casting for calendario_fiscal

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:30:49 +00:00
Consultoria AS
0c4b1a43a9 feat(fase3): update sidebar navigation and seed with calendario_fiscal
- Add navigation items for Reportes, Calendario, Alertas, Usuarios
- Add calendario_fiscal table creation in seed
- Insert demo fiscal events for all 12 months

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:04:25 +00:00
Consultoria AS
9b8aaea7eb feat(alertas): add alerts CRUD with stats and management UI
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 03:02:20 +00:00
Consultoria AS
6d59c8d842 feat(export): add Excel export for CFDIs and reports
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:58:19 +00:00
Consultoria AS
b25816df20 chore: Phase 2 complete - Dashboard, CFDI, Impuestos modules
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:37:45 +00:00
Consultoria AS
45768f03b5 feat(web): redirect home to dashboard 2026-01-22 02:36:55 +00:00
Consultoria AS
62113c7fba feat(web): add configuracion page with theme selector 2026-01-22 02:36:20 +00:00
Consultoria AS
1dcc98aada feat(web): add impuestos page with IVA/ISR control 2026-01-22 02:34:34 +00:00
Consultoria AS
554474d62f feat(web): add CFDI page with list, filters, and pagination
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:31:59 +00:00
Consultoria AS
6372f8afc5 feat(web): add dashboard page with KPIs, charts, and alerts
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:29:54 +00:00
Consultoria AS
a8265b9822 feat(web): add dashboard API client and hooks
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:28:06 +00:00
Consultoria AS
ccfc795d41 feat(web): add chart components (KpiCard, BarChart) 2026-01-22 02:27:02 +00:00
Consultoria AS
06e9f3eba7 feat(web): add dashboard layout with sidebar and header
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:25:35 +00:00
Consultoria AS
9d49f8a833 feat(api): add impuestos API endpoints (IVA/ISR mensual y resumen)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:23:54 +00:00
Consultoria AS
a81d8437ce feat(api): add CFDI API endpoints (list, detail, resumen)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:21:25 +00:00
Consultoria AS
4d0d23c642 feat(api): add dashboard API endpoints (kpis, ingresos-egresos, resumen-fiscal, alertas) 2026-01-22 02:19:22 +00:00
Consultoria AS
5bd5f9cef9 feat(api): add tenant middleware for multi-tenant schema isolation 2026-01-22 02:17:15 +00:00
Consultoria AS
7cc8842f8d feat(shared): add types for dashboard, cfdi, and impuestos 2026-01-22 02:16:24 +00:00
Consultoria AS
c8a1fac045 chore: add Phase 2 dependencies (recharts, tanstack-table, date-fns) 2026-01-22 02:15:15 +00:00
Consultoria AS
72a1e9a39c docs: add Phase 2 implementation plan
- Dashboard with KPIs and charts
- CFDI management (list, filters, pagination)
- IVA/ISR control modules
- Protected dashboard layout
- 15 tasks with complete code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:13:52 +00:00
Consultoria AS
79b771b650 feat: add database seed with demo data and Docker Compose setup
- Seed creates demo tenant, users (admin, contador, visor)
- Creates tenant schema with cfdis, iva_mensual, alertas tables
- Inserts 50 demo CFDIs and 6 months of IVA records
- Docker Compose with PostgreSQL, API, and Web services
- Demo credentials: admin/contador/visor @demo.com / demo123

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:02:30 +00:00
Consultoria AS
9986bc1dd3 feat(web): add login and register pages with auth store
- API client with token refresh interceptor
- Auth API functions (login, register, logout, getMe)
- Auth store with Zustand persistence
- Auth layout with centered card design
- Login page with form validation
- Register page with company and user data
- Environment example file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:01:29 +00:00
Consultoria AS
984f1aeb8d feat(web): add base UI components
- Button with variants (default, destructive, outline, secondary, ghost, link, success)
- Input with consistent styling
- Card with Header, Title, Description, Content, Footer
- Label using Radix UI primitives
- Index file for centralized exports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 02:00:33 +00:00
Consultoria AS
4389f50e7d feat: implement 4-theme system with Zustand persistence
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:58:24 +00:00
Consultoria AS
cbc48cfe26 feat: add Next.js frontend base structure
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:56:17 +00:00
Consultoria AS
e54019ba01 feat: implement JWT authentication system
Add complete authentication infrastructure including:
- Password hashing utilities with bcrypt
- JWT token generation and verification
- Auth service with register, login, refresh, and logout
- Auth controller with Zod validation
- Auth middleware for route protection
- Auth routes mounted at /api/auth

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:54:13 +00:00
Consultoria AS
18bdb24478 feat: add Prisma schema with multi-tenant support
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:51:48 +00:00
Consultoria AS
af617627a4 feat: add Express API base structure
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:50:22 +00:00
Consultoria AS
830e98625d feat: add shared package with types and constants
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:48:57 +00:00
Consultoria AS
dc0056b243 chore: initialize monorepo with Turborepo and pnpm
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:47:28 +00:00
Consultoria AS
ed16c8cd39 docs: add Phase 1 implementation plan
Detailed step-by-step plan covering:
- Monorepo setup with Turborepo + pnpm
- Shared package with types and constants
- Express API with JWT authentication
- Prisma with PostgreSQL multi-tenant (schema per tenant)
- Next.js 14 frontend
- 4-theme system (Light, Vibrant, Corporate, Dark)
- Login/Register pages with auth store
- Demo data seed
- Docker Compose configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:41:07 +00:00
Consultoria AS
e0c97cb3b6 Initial commit: Horux360 SaaS design documentation
- Complete design document with architecture, data models, and API specs
- Database schema (Prisma) for multi-tenant PostgreSQL
- README with project overview and plans
- Support for 4 visual themes (Light, Vibrant, Corporate, Dark)
- Comprehensive module specifications:
  - Dashboard with KPIs
  - CFDI management
  - IVA/ISR tax control
  - Bank reconciliation
  - Fiscal calendar
  - User management with roles

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 01:28:58 +00:00