Skip to content

Conversation

@SheetMetalConnect
Copy link
Owner

No description provided.

Phase 1 - Database Schema:
- Add external_id, external_source, synced_at, sync_hash columns to jobs, parts, operations, resources, cells
- Add composite unique indexes for upsert by external_id
- Add soft delete columns (deleted_at, deleted_by)
- Add sync_imports table for tracking import batches

Phase 2 - REST API Sync Endpoints:
- Create new api-resources endpoint with full CRUD + sync
- Add PUT /sync and POST /bulk-sync to api-jobs (with nested parts/operations)
- Add PUT /sync and POST /bulk-sync to api-parts
- Add PUT /sync and POST /bulk-sync to api-operations
- Add PUT /sync and POST /bulk-sync to api-cells

Features:
- Upsert by external_id for ERP integration
- Bulk sync supports up to 1000 records per request
- Lookup by external_id or name for related entities
- Change detection via sync_hash
- Import logging to sync_imports table
- Create DataImport.tsx with 6-step import wizard (select, upload, map, preview, import, complete)
- Add Papa Parse CSV parsing with auto field mapping
- Add validation preview with error highlighting
- Add downloadable CSV templates for each entity type (jobs, parts, operations, cells, resources)
- Support upsert via external_id for ERP integration
- Add chunked import processing (100 records per batch)
- Add route /admin/data-import and navigation link under Integrations
- Add i18n translations for all import UI strings

This complements the REST API sync endpoints for batch data imports.
- Fix generateSyncHash to use SHA-256 instead of MD5 (MD5 not supported by Web Crypto API)
- Truncate hash to 32 chars for brevity (same length as MD5 output)
- Add missing i18n translations for DataImport component
- Add "ERP Sync" and "Resources" tags
- Document sync endpoints: PUT /sync (single) and POST /bulk-sync (batch)
- Add endpoints for jobs, parts, operations, resources, and cells
- Add schema definitions for all sync request/response types
- Add examples for nested sync (job with parts and operations)
- Document BulkSyncResponse with created/updated/errors counts
- Add new "ERP Integration" tab to Help.tsx with:
  - Two-way sync architecture overview
  - API sync endpoint examples with code samples
  - CSV import step-by-step guide
  - Field reference tables
  - Best practices

- Create markdown documentation in docs/:
  - docs/ERP_INTEGRATION.md - Architecture overview
  - docs/API_SYNC.md - Detailed API endpoint reference
  - docs/CSV_IMPORT.md - CSV import field reference and templates
@SheetMetalConnect SheetMetalConnect merged commit 3700732 into main Dec 3, 2025
3 checks passed
@SheetMetalConnect SheetMetalConnect deleted the claude/review-api-import-architecture-01Y1vZZpMemBw56eLWYXznZi branch January 18, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants