Add comprehensive admin features and multi-system integration

- Add admin dashboard with sync controls and data browser
- Implement RMM, Auvik, and Addigy organization mappings
- Add chunked ticket sync with progress tracking
- Implement entity sync service with rate limiting
- Add analytics engine and performance optimizer
- Create data browser for all PSA entities
- Add navigation components and UI improvements
- Implement background processing and sync services
- Add comprehensive documentation and migration scripts
- Update configuration items with multi-system support
- Enhance contact management and purchase history
- Add issue type assignment and LLM analyzer
- Improve error handling and logging utilities
This commit is contained in:
root 2025-11-19 14:18:16 -05:00
parent e8462ef301
commit 6eee14f8af
171 changed files with 32671 additions and 621 deletions

52
FIX_TICKET_SYNC.md Normal file
View file

@ -0,0 +1,52 @@
# Quick Fix for Ticket Sync Constraint Error
## The Problem
```
Database error: insert or update on table "tickets" violates foreign key constraint "tickets_assigned_resource_id_fkey"
```
## The Fix (2 Steps)
### Step 1: Run Database Migration
```bash
docker exec pulse-app psql $DATABASE_URL -f /app/migrations/008_relax_tickets_resource_constraints.sql
```
### Step 2: Restart the App (to load new code)
```bash
docker-compose restart app
```
## Test the Fix
```bash
# Trigger a ticket sync
curl -X POST http://localhost:3000/api/sync/entity \
-H "Content-Type: application/json" \
-d '{"entities": ["tickets"], "yearsBack": 1, "triggeredBy": "admin"}'
# Watch the logs
docker logs -f pulse-app
```
## What Changed
**Database:**
- Made resource foreign keys deferrable and lenient
- Tickets can now exist even if assigned resource doesn't exist
- Invalid resource IDs are set to NULL instead of causing failure
**Application:**
- Validates resource IDs before inserting tickets
- Logs warnings for tickets with invalid resource references
- Caches valid resource IDs for performance
## Expected Results
✅ Ticket sync completes successfully
✅ Warnings logged for tickets with invalid resource IDs
✅ Those tickets have `assigned_resource_id` set to NULL
✅ All other ticket data is preserved
## More Details
See `/opt/stacks/pulse/docs/TICKET_SYNC_FIX.md` for complete documentation.