-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add GET /api/v1/compliance-checklist endpoint
#247
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
Conversation
|
Warning Rate limit exceeded@UlisesGascon has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 31 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughA new API endpoint, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API_Router
participant Store
Client->>API_Router: GET /api/v1/compliance-checklist
API_Router->>Store: getAllChecklists()
Store-->>API_Router: List of ComplianceChecklists
API_Router-->>Client: 200 OK + JSON array of checklists
alt Error occurs
API_Router-->>Client: 500 Internal Server Error + error message
end
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/httpServer/routers/apiV1.js (1)
149-157: Consider pluralizing the resource path and adding basic pagination
/compliance-checklistreturns a collection, yet the path is singular. Following common REST conventions, collections are named in plural form (e.g.,/compliance-checklists).
Additionally, if this list can grow, the absence of pagination or limit/offset query params could cause very large payloads.-router.get('/compliance-checklist', async (req, res) => { +// `/compliance-checklists?limit=100&offset=0` +router.get('/compliance-checklists', async (req, res) => {Implementing pagination now will avoid a breaking change later.
__tests__/httpServer/apiV1.test.js (1)
440-447: Use date-insensitive assertions to remove the JSON stringify hackSerialising objects just to strip
Dateinstances is brittle and masks real shape regressions.
Prefer explicit assertions:const expected = storedChecklists.map(c => ({ ...c, created_at: c.created_at.toISOString(), updated_at: c.updated_at.toISOString() })); expect(response.body).toStrictEqual(expected);Or simply:
expect(response.body).toEqual( expect.arrayContaining(storedChecklists.map(expect.objectContaining)) )This keeps tests readable and resilient.
src/httpServer/swagger/api-v1.yml (2)
327-348: OpenAPI path is out of sync with REST conventions and router codeThe spec defines
/api/v1/compliance-checklist, mirroring the router, but both are singular while the tag is plural (“Compliance Checklists”).
Recommend renaming the path to/api/v1/compliance-checklistsfor consistency and updating operationId accordingly:-/api/v1/compliance-checklist: +/api/v1/compliance-checklists: get: - operationId: listComplianceChecklists + operationId: listComplianceChecklistsThis avoids confusion for API consumers and aligns with plural collection naming.
350-393: Minor schema polish
author,titleandcode_namemight benefit frommaxLengthto guard against oversize payloads (onlytitle/code_namecapped now).- If
urlmust be HTTPS, add a pattern to enforce it (^https://).Not blocking, but improves validation strength.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
__tests__/httpServer/apiV1.test.js(3 hunks)src/httpServer/routers/apiV1.js(2 hunks)src/httpServer/swagger/api-v1.yml(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Playwright Tests
16aeda5 to
73e1175
Compare
Related #216
Summary by CodeRabbit
New Features
Tests