Skip to content

feat: Add support for fetching all notification templates#57

Open
VaishnaviSidral wants to merge 3 commits into
tekdi:mainfrom
VaishnaviSidral:email-template-list-support
Open

feat: Add support for fetching all notification templates#57
VaishnaviSidral wants to merge 3 commits into
tekdi:mainfrom
VaishnaviSidral:email-template-list-support

Conversation

@VaishnaviSidral
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@VaishnaviSidral has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 35 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7699f642-8c46-40ba-a58f-035064e7f9aa

📥 Commits

Reviewing files that changed from the base of the PR and between 51019c0 and f87a385.

📒 Files selected for processing (1)
  • src/modules/notification_events/dto/searchTemplateType.dto.ts
📝 Walkthrough

Walkthrough

The PR makes search filter parameters optional in the notification events module. The SearchDto.context and SearchFilterDto.filters fields are changed from required to optional, and the getTemplates service method is updated to safely access these potentially undefined nested properties using optional chaining.

Changes

Optional Search Filters

Layer / File(s) Summary
DTO contract for optional filters
src/modules/notification_events/dto/searchTemplateType.dto.ts
SearchDto.context and SearchFilterDto.filters are marked optional with TypeScript ?: syntax, @IsOptional() decorators, and @ApiProperty({ required: false }) metadata.
Service method handling optional filter state
src/modules/notification_events/notification_events.service.ts
getTemplates uses optional chaining to derive context and key from the potentially undefined searchFilterDto.filters, initializes whereCondition as an empty object, and conditionally applies filters only when values are present.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided; the PR contains no author-provided description text. Add a description explaining the feature, why optional filters are needed, and any breaking changes or migration notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making filter parameters optional to support fetching all templates when filters are not provided.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the search functionality for notification events by making the search filters optional. Specifically, it modifies the SearchDto and SearchFilterDto to allow for missing context and filter objects, and updates the NotificationEventsService to handle these optional parameters when building database queries. A review comment correctly identifies a validation issue where the context property in SearchDto is missing the @IsOptional() decorator; without this, class-validator will still enforce @IsString() and @IsNotEmpty() even if the field is omitted in the request.

Comment thread src/modules/notification_events/dto/searchTemplateType.dto.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a 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/modules/notification_events/dto/searchTemplateType.dto.ts (1)

22-24: ⚡ Quick win

Use @ValidateNested() without each: true for a single nested DTO.

The each: true option is intended for validating elements within collections (arrays, sets, maps). Since filters is a single SearchDto object, not an array, the each: true parameter should be removed. This makes the validator behavior explicit and correct.

Proposed fix
-@ValidateNested({ each: true })
+@ValidateNested()
 `@Type`(() => SearchDto)
 filters?: SearchDto
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/notification_events/dto/searchTemplateType.dto.ts` around lines
22 - 24, The `@ValidateNested` decorator on the filters property is incorrectly
using each: true for a single nested DTO; update the validation on filters
(typed as SearchDto) by removing the each: true option so that `@ValidateNested`()
is applied without each: true and keep the existing `@Type`(() => SearchDto)
decorator to ensure proper transformation and nested validation of the SearchDto
instance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/modules/notification_events/dto/searchTemplateType.dto.ts`:
- Around line 7-10: The context property on the DTO is currently decorated with
`@IsString`() and `@IsNotEmpty`(), which causes validation to fail when context is
omitted; add the `@IsOptional`() decorator to the context field in the
SearchTemplateType DTO (the property named context in the DTO class in
searchTemplateType.dto.ts) so that `@IsNotEmpty`() only runs when a value is
present and requests without a context are accepted.

---

Nitpick comments:
In `@src/modules/notification_events/dto/searchTemplateType.dto.ts`:
- Around line 22-24: The `@ValidateNested` decorator on the filters property is
incorrectly using each: true for a single nested DTO; update the validation on
filters (typed as SearchDto) by removing the each: true option so that
`@ValidateNested`() is applied without each: true and keep the existing `@Type`(()
=> SearchDto) decorator to ensure proper transformation and nested validation of
the SearchDto instance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 35cc2239-31f2-45fc-9381-2e67bdcfe251

📥 Commits

Reviewing files that changed from the base of the PR and between fe9f563 and 51019c0.

📒 Files selected for processing (2)
  • src/modules/notification_events/dto/searchTemplateType.dto.ts
  • src/modules/notification_events/notification_events.service.ts

Comment thread src/modules/notification_events/dto/searchTemplateType.dto.ts
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant