-
-
Notifications
You must be signed in to change notification settings - Fork 3
Dynamic reports #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic reports #228
Conversation
WalkthroughThis update introduces several new features and refactors across the server, reporting, and testing layers. The HTTP server now supports website routes with EJS templating and improved shutdown logic, including forced connection termination and timeouts. The reports module is modularized with new data collection and validation functions, internal link generation, and enhanced template handling using EJS partials for head, navigation, and footer. JSON schemas for index and project data are added, along with corresponding validators. The store layer gains a method for fetching projects by ID. Comprehensive tests are added for website routes and internal link generation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HTTPServer
participant WebRouter
participant Store
participant Reports
participant Templates
User->>HTTPServer: GET /
HTTPServer->>WebRouter: Handle /
WebRouter->>Reports: collectIndexData(knex)
Reports->>Store: Fetch projects, checklists, checks
Store-->>Reports: Data
Reports-->>WebRouter: Validated index data
WebRouter->>Templates: Render index.ejs with data
Templates-->>User: HTML response
User->>HTTPServer: GET /projects/:id
HTTPServer->>WebRouter: Handle /projects/:id
WebRouter->>Store: getProjectById(id)
Store-->>WebRouter: Project or null
alt Project found
WebRouter->>Reports: collectProjectData(knex, id)
Reports->>Store: Fetch project-related data
Store-->>Reports: Data
Reports-->>WebRouter: Validated project data
WebRouter->>Templates: Render project.ejs with data
Templates-->>User: HTML response
else Project not found or invalid id
WebRouter->>Templates: Render notFound.ejs
Templates-->>User: 404 HTML response
end
Possibly related PRs
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Use integrity check for FE libraries - Remove unused static resources from server - Remove dependency `serve-index` - Add test cases for `validateProjectData` and `validateIndexData` schemas - Proper ordering of shutdown steps - More graceful handling of active connections - Better error handling and logging - Move to `__dirname` from `process.cwd()` - Fix bug filtering scorecard ownership - Enhance navigation accessibility
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
I will handle the last suggestions in my next PR |
Ref: #228 (comment) - Replace `process.cwd()` with `__dirname` for reliable path resolution - Fix HTTP server connection listener leak on multiple start/stop cycles - Add default empty string for ref parameter in internalLinkBuilder - Replace `parseInt()` with `Number()` for better type conversion - Add `implementation_status` enum to `indexData` schema
Ref: #228 (comment) - Replace `process.cwd()` with `__dirname` for reliable path resolution - Fix HTTP server connection listener leak on multiple start/stop cycles - Add default empty string for ref parameter in internalLinkBuilder - Replace `parseInt()` with `Number()` for better type conversion - Add `implementation_status` enum to `indexData` schema
Ref: #228 (comment) - Replace `process.cwd()` with `__dirname` for reliable path resolution - Fix HTTP server connection listener leak on multiple start/stop cycles - Add default empty string for ref parameter in internalLinkBuilder - Replace `parseInt()` with `Number()` for better type conversion - Add `implementation_status` enum to `indexData` schema
Related #219
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests
Chores