Feature/export endpoints - #39
Merged
Merged
Conversation
…structure - Create src/config/index.js for centralized configuration - Create src/routes/index.js for route aggregation - Create src/services/index.js for service initialization - Create src/app.js for Express app configuration - Create src/server.js for HTTP server with graceful shutdown - Update index.js to minimal entry point - Update package.json scripts - Update test imports to use src/app.js - Add unit tests for app.js - Add integration tests for server.js This refactoring improves separation of concerns, testability, and maintainability. The app can now be imported without starting the server, enabling faster tests. Graceful shutdown handling for SIGTERM/SIGINT signals is implemented. Resolves EquipChain#28
…on prevention - Add MAX_BODY_SIZE env var (default 1MB) for request payload limits - Create XSS sanitization utility (src/utils/sanitize.js) with escape-html - Add Helmet middleware for security headers (XSS, CSP, etc.) - Sanitize user data in error responses and logs to prevent XSS/log injection - Configure Pino redact to mask sensitive fields in logs - Add ESLint security plugin with SQL injection prevention rules - Create comprehensive security integration tests - Add Content-Type enforcement middleware for JSON responses - Update .env.example with new security configuration Resolves EquipChain#30
- Add in-memory job queue service (src/services/queue.js) - Support for job prioritization, concurrency control, and retry with exponential backoff - Job status tracking (queued, running, completed, failed, cancelled) - API: add(), schedule(), getStatus(), cancel(), getStats() - Add scheduler service (src/services/scheduler.js) - Cron-like recurring job scheduling - Support for numeric intervals and simple cron expressions - API: schedule(), cancelSchedule(), getSchedule(), getAllSchedules() - Create job handlers (src/jobs/) - billing.job.js - Aggregate readings and compute charges - reports.job.js - Generate daily/monthly usage reports - sync.job.js - Sync on-chain data with local state - webhookRetry.job.js - Retry failed webhook deliveries - cacheWarm.job.js - Warm cache for frequently accessed data - Add webhook service (src/services/webhook.js) - Queue-based webhook delivery with automatic retries - Integrate queue and scheduler in src/services/index.js - Register all job handlers - Configure recurring schedules (hourly billing, daily/monthly reports, periodic sync, cache warming) - Update health endpoint to expose queue and scheduler statistics - Add unit tests for queue and scheduler Resolves EquipChain#18
Implement export endpoints for meter readings, analytics summaries, and system reports with support for CSV, JSON, and NDJSON formats. Features include: - Streaming export service using Node.js streams and csv-stringify - Column selection via ?fields parameter - Date range and metadata filtering - Proper Content-Type and Content-Disposition headers - Transfer-Encoding: chunked for large dataset support - Authentication and authorization middleware - Comprehensive unit and integration tests - Updated README with export documentation Closes EquipChain#23
Member
|
CI failed. FIx it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.