-
Notifications
You must be signed in to change notification settings - Fork 29
feat: support sort by name in issue #1459
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
WalkthroughThis pull request updates the sorting logic in the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant IS as IssueService
participant QB as QueryBuilder
C->>IS: findIssuesByProjectIdV2(projectId, fieldName, sort)
alt fieldName equals "name"
IS->>QB: Add "ORDER BY issues.name" with sort method
else Other field conditions
IS->>QB: Process existing sorting logic
end
QB-->>IS: Return sorted results
IS-->>C: Return ordered issues
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ 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:
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 (2)
apps/api/src/domains/admin/project/issue/issue.service.ts (2)
264-277
: Consider adding support for sorting by other available fields.While the PR successfully adds sorting by the
name
field, there are other fields likestatus
,description
, andexternalIssueId
that are available for filtering but not for sorting. For consistency and completeness, you might want to support sorting by these fields as well.} else if (fieldName === 'updatedAt') { queryBuilder.addOrderBy(`issues.updated_at`, sort[fieldName]); } else if (fieldName === 'name') { queryBuilder.addOrderBy(`issues.name`, sort[fieldName]); + } else if (fieldName === 'status') { + queryBuilder.addOrderBy(`issues.status`, sort[fieldName]); + } else if (fieldName === 'externalIssueId') { + queryBuilder.addOrderBy(`issues.external_issue_id`, sort[fieldName]); + } else if (fieldName === 'description') { + queryBuilder.addOrderBy(`issues.description`, sort[fieldName]); }
264-277
: Consider adding a default case for unknown sort fields.Currently, if an unsupported field is provided for sorting, it's silently ignored. For better error handling, consider adding a default case that either logs a warning or throws an exception for unsupported sort fields.
} else if (fieldName === 'updatedAt') { queryBuilder.addOrderBy(`issues.updated_at`, sort[fieldName]); } else if (fieldName === 'name') { queryBuilder.addOrderBy(`issues.name`, sort[fieldName]); + } else { + this.logger.warn(`Unsupported sort field: ${fieldName}`); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/api/src/domains/admin/project/issue/issue.service.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: integration-test
🔇 Additional comments (1)
apps/api/src/domains/admin/project/issue/issue.service.ts (1)
275-276
: Good addition to support name sorting.The implementation correctly extends the existing sort functionality to include sorting by issue name, following the established pattern for other fields.
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.
👍🏼
Summary by CodeRabbit