Commit Graph

62 Commits

Author SHA1 Message Date
Misaka_Company
73a49f9de3 docs: add settings partial save feature documentation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-03 15:12:39 +08:00
Misaka_Company
429357ae8c docs: add implementation plan for settings partial save feature
- 8 detailed tasks with step-by-step instructions
- TDD approach with failing tests first
- Complete code snippets provided
- Manual testing procedures included
- Estimated 2-3 hours implementation time
2026-03-03 12:25:59 +08:00
Misaka_Company
79934a58d0 docs: add settings partial save design document
- Problem: Settings page overwrites unmodified .env fields
- Solution: Deep merge + whitelist validation approach
- Added backup mechanism for safe rollback
- Designed extensible whitelist for future UI expansion
2026-03-03 12:24:27 +08:00
Misaka_Company
6ecf03ce11 fix: scope User operations to visible data only in CleanerPage
Fix critical bug where non-Admin users could affect other users' data
when using "取消" (Uncheck All) and "确认删除" (Confirm Deletion) buttons.

Problem:
- User users see only their filtered materials in table (filteredResults)
- "取消" button was unchecking ALL materials in validationResults
- "确认删除" was processing ALL materials, not just visible ones
- This caused User A to delete/modify User B's invisible data

Solution:
1. Modified "取消" button to only uncheck visible filteredResults
   - Now removes selectedItems only for visible material codes
   - Preserves selections for other users' invisible data

2. Modified handleConfirmDeletion to process only visible items for non-Admin users
   - Admin: processes all validationResults (unchanged behavior)
   - User: processes only filteredResults (scoped to their data)

Security Impact:
- Prevents cross-user data interference
- Ensures User scope isolation
- Maintains Admin full access to all data

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-03 11:13:39 +08:00
Misaka_Company
77311edce0 feat: add user override match for material validation in cleaner page
Add Priority 3 matching logic that allows User type users to override
material assignments with their own typeKeywords from MaterialsTypeToBeDeleted.

Changes:
- Add session manager integration to get current user context
- Implement Priority 3: User Override Match (only for non-admin users)
- Filter typeKeywords by current username and force override on match
- Maintain existing Priority 1 (exact match) and Priority 2 (type match) behavior
- Admin users bypass override logic and see original matching results
- Update cleaner-validation-flow.md with new matching algorithm flow

This ensures User users see materials assigned to themselves first when
their configured typeKeywords match, while Admin users maintain full visibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-03 10:45:25 +08:00
Misaka_Company
edf696ab39 docs: fix Mermaid syntax error in settings save flow diagram
Replace pipe character in dbType union notation with 'or' to resolve Mermaid parse error.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-03 09:11:35 +08:00
Misaka_Company
6ec422f357 docs: add UI flow analysis documentation and update gitignore
Add documentation for extractor start button and settings save button flows with detailed Mermaid diagrams. Also add logs directory to gitignore.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-03 09:06:33 +08:00
Misaka
a05c8a9037 feat: add TypeORM, logger, schemas, hooks and stores
- Add TypeORM integration with data-source, entities and repositories
- Add logger service for structured logging
- Add Zod validation schemas for auth, cleaner and extractor
- Add custom React hooks (useAuth, useCleaner, useExtractor, useValidation)
- Add Zustand stores (useAppStore, useUserStore)
- Add UI components (Button, Modal, Toast)
- Add error types and ErpBrowserManager
- Refactor IPC handlers and services
- Add unit tests for new modules

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
2026-03-02 23:10:15 +08:00
Misaka_Company
11aec6d238 docs: fix Mermaid diagram syntax in deleteByMaterialCodes flow
- Remove problematic edge labels with special characters
- Move database type identifiers into node labels
- Replace ellipsis with clearer text descriptions
- Fix parse error caused by spaces and special chars in edge labels

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-02 13:17:38 +08:00
Misaka_Company
9fbf75a8a0 docs: add confirm deletion button flow analysis to cleaner validation docs
Add comprehensive documentation for the "确认删除 (同步数据库)" button
flow, including:

- Core flow overview with Mermaid diagram
- Frontend interaction layer analysis (handleConfirmDeletion)
- IPC handler layer details (upsertBatch, delete handlers)
- Database DAO layer implementation with MySQL vs SQL Server differences
- Data flow diagram showing all layers
- Key data structures and error handling
- Comparison table with validation status flow

The document now covers both core business flows in the cleaner page:
1. Get and validate material status (read operation)
2. Confirm deletion/sync to database (write operation)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-02 12:49:31 +08:00
Misaka_Company
10e07cdf93 docs: add cleaner validation flow analysis with Mermaid diagrams
Add comprehensive technical documentation for the cleaner page
"get validation status" functionality, including:
- Complete flow analysis from UI click to database queries
- Mermaid flowcharts and sequence diagrams
- Material matching algorithm (priority-based)
- Database interaction details (MySQL/SQL Server)
- IPC handler logic
- Shared Production IDs mechanism

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-02 12:29:53 +08:00
Misaka
e794470d69 docs: add comprehensive user documentation
- Add README.md with installation, configuration, and usage guide
- Add docs/USER_GUIDE.md with detailed step-by-step workflows
- Include database setup scripts for MySQL and SQL Server
- Add troubleshooting section with common issues
2026-03-01 15:57:07 +08:00