-
Notifications
You must be signed in to change notification settings - Fork 0
add closestEndDate sort type #119
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
|
""" WalkthroughA new sorting option, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant PollService
participant Database
Client->>PollService: getPolls(sortBy: CLOSEST_END_DATE)
PollService->>Database: Query active polls (order by endDate ASC)
PollService->>Database: Query ended polls (order by endDate DESC)
PollService->>PollService: Combine and paginate results
PollService->>PollService: Map vote status
PollService->>Client: Return sorted polls with total count
Possibly related PRs
Suggested reviewers
Poem
""" 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ 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: 1
🧹 Nitpick comments (1)
src/poll/poll.service.ts (1)
442-492: CLOSEST_END_DATE implementation is functionally correct.The new sorting logic properly handles:
- Active polls ordered by closest ending date (ascending)
- Ended polls ordered by most recently ended (descending)
- Consistent transaction pattern and pagination logic
However, note that this implementation ignores the
sortOrderparameter, which might be unexpected behavior compared to other sort types.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/poll/Poll.dto.ts(1 hunks)src/poll/poll.service.ts(1 hunks)
🔇 Additional comments (1)
src/poll/Poll.dto.ts (1)
20-20: LGTM! Clean enum extension.The new
CLOSEST_END_DATEenum value follows consistent naming conventions and properly supports the enhanced sorting functionality.
Summary by CodeRabbit
New Features
Refactor