ComplianceNFs/TODOs-and-Roadmap.md
Giuliano Paschoalino e6b2180c94 feat(logging): Implement robust logging across infrastructure, application, and UI layers
- Added Microsoft.Extensions.Logging to various projects for enhanced logging capabilities.
- Updated AccessDbRepository and AttachmentRepository to include logging for database operations.
- Integrated logging into MailListener for better error handling and operational insights.
- Modified tests to utilize mocks for ILogger to ensure logging behavior is tested.
- Enhanced App.xaml.cs and MainWindow.xaml.cs to log application startup and initialization events.
- Created LoggingBootstrapper to configure logging services in the WPF application.
- Updated TODOs-and-Roadmap.md to reflect the addition of logging features.
2025-06-18 17:38:52 -03:00

109 lines
4.0 KiB
Markdown

# ComplianceNFs TODOs and Roadmap
## TODOs in Codebase
### ComplianceNFs.Infrastructure/Archiving/FileArchiver.cs
- [x] FileArchiver.ArchiveAsync: Create subfolder for invoice.Status, move file
### ComplianceNFs.Infrastructure/Mail/MailListener.cs
- [x] MailListener.StartListening: Connect to Outlook app, filter by allowlist, support account/folder selection, recursively process subfolders, raise NewMailReceived
- [x] Add logging and error handling for Outlook interop failures
### ComplianceNFs.Infrastructure/Parsers/PdfParser.cs
- [x] PdfParser.Parse: Use iTextSharp or PdfSharp to extract text/numbers via regex
### ComplianceNFs.Infrastructure/Parsers/XmlParser.cs
- [x] XmlParser.Parse: Use System.Xml to parse known elements
### ComplianceNFs.Infrastructure/Repositories/AccessDbRepository.cs
- [x] AccessDbRepository.GetByUnidade: Implement actual query to Access DB
- [x] AccessDbRepository.GetByUnidadeAndMonth: Implement actual query to Access DB
### ComplianceNFs.Infrastructure/Repositories/AttachmentRepository.cs
- [x] AttachmentRepository.SaveRawAsync: Implement actual insert into Postgres attachments table
- [x] AttachmentRepository.UpdateMatchAsync: Implement actual update in Postgres
- [x] Add robust logging for DB operations and errors
### ComplianceNFs.Core/Application/Services
- [x] InvoiceIngestionService: Implement ingestion logic and subscribe to NewMailReceived
- [x] MatchingService: Implement invoice matching logic
- [x] Add fallback and multi-invoice sum logic in MatchAsync
- [x] ComplianceService: Implement compliance validation logic
- [x] NotificationService: Implement notification logic for mismatches
- [x] ArchivingService: Implement archiving logic for final status
- [x] Add robust logging to application services
### ComplianceNFs.Monitor/MonitorViewModel.cs
- [ ] MonitorViewModel: Inject IInvoiceStatusStream and subscribe to updates
- [ ] MonitorViewModel.ForceScan: Call service to force ingestion cycle
### ComplianceNFs.Service/Program.cs
- [x] Register application services (InvoiceIngestionService, MatchingService, etc.)
---
## Roadmap to Finish the App
### 1. Infrastructure Layer
- [x] **FileArchiver**: Implement logic to create subfolders by `InvoiceStatus` and move files accordingly.
- [x] **MailListener**: Use Outlook Interop to connect to local Outlook, filter by allowlist, support account/folder selection, recursively process subfolders, and raise `NewMailReceived` event.
- [x] **PdfParser**: Integrate iTextSharp or PdfSharp, extract invoice data using regex.
- [x] **XmlParser**: Use System.Xml to parse invoice XMLs and map to `ParsedInvoice`.
- [x] **AccessDbRepository**: Implement queries to Access DB for buying records.
- [x] **AttachmentRepository**: Implement Postgres insert/update for invoice attachments.
- [x] Add robust logging and error handling for all infrastructure components.
### 2. Application Layer
- [x] Implement and register:
- InvoiceIngestionService
- MatchingService
- ComplianceService
- NotificationService
- ArchivingService
- [x] Wire up these services in DI in `Program.cs`.
- [x] Add fallback and multi-invoice sum logic in `MatchingService.MatchAsync`.
- [x] Add robust logging to application services.
### 3. Service Host
- [x] Ensure all services are registered and started in the Worker.
- [x] Implement polling and retry logic as per configuration.
- [x] Add robust logging to workflow orchestration.
### 4. WPF Monitor
- [ ] Inject and subscribe to `IInvoiceStatusStream` in `MonitorViewModel`.
- [ ] Implement `ForceScan` to trigger ingestion from UI.
- [ ] Bind UI to show recent invoice status updates.
- [x] Add logging for UI events and errors.
### 5. Configuration & Testing
- [ ] Test all configuration values from `appsettings.json`.
- [x] Add error handling, logging, and validation.
- [ ] Write integration tests for end-to-end flow.
---
**Note:**
Robust logging is now implemented across infrastructure, application, service, and UI layers. Review log output and adjust log levels as needed for production.