Skip to content

Add contact count endpoint and service method - #44

Merged
yamcodes merged 3 commits into
mainfrom
7-add-contact-count-endpoint
Mar 21, 2026
Merged

Add contact count endpoint and service method#44
yamcodes merged 3 commits into
mainfrom
7-add-contact-count-endpoint

Conversation

@yamcodes

@yamcodes yamcodes commented Mar 21, 2026

Copy link
Copy Markdown
Owner

Closes #7

Summary by CodeRabbit

New Features

  • Added a new API endpoint that returns the total number of contacts currently stored in the system as a plain-text response. This enables users to easily query the contact database size and retrieve aggregated contact count information for monitoring, reporting, and integration purposes.

@yamcodes yamcodes linked an issue Mar 21, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Mar 21, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

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

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ccd1e0e4-dea0-47e7-8521-db962ed929dc

📥 Commits

Reviewing files that changed from the base of the PR and between 9d8b476 and 7a17d09.

📒 Files selected for processing (1)
  • src/main/java/codes/yam/contacts/ContactController.java
📝 Walkthrough

Walkthrough

This pull request introduces a new HTTP GET endpoint /contacts/count in the ContactController that returns the total number of contacts as plain text. The endpoint delegates to a new count() method in ContactService, which calls the repository's count() operation.

Changes

Cohort / File(s) Summary
Contact Count Feature
src/main/java/codes/yam/contacts/ContactController.java, src/main/java/codes/yam/contacts/ContactService.java
Added count() method to service that delegates to repository, and new @GetMapping("/count") endpoint in controller returning contact count formatted as (%d total contacts)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • Shadcn UI - like UI #35: Modifies ContactController for listing handler/imports; both PRs affect the same controller class and domain

Poem

🐰 A counter appears with gentle care,
Tallying contacts everywhere,
/count whispers soft and true,
"How many friends do I have? Few!" ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The implementation adds the GET /contacts/count endpoint but the response format '(%d total contacts)' does not match the required format '(42 total Contacts)' with capitalized 'Contacts'. Update the response format in ContactController.count() to use '(%d total Contacts)' with capitalized 'Contacts' to match issue #7 requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add contact count endpoint and service method' accurately summarizes the main changes, which include adding a new GET endpoint for contact count and supporting service method.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the contact count endpoint feature specified in issue #7; no out-of-scope modifications detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 7-add-contact-count-endpoint

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.

@yamcodes
yamcodes marked this pull request as ready for review March 21, 2026 16:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/codes/yam/contacts/ContactController.java`:
- Around line 113-117: The count() handler in ContactController returns "(%d
total contacts)" but the endpoint contract expects "(%d total Contacts)"; update
the returned formatted string in the count() method to use "Contacts" with a
capital C (keep using contactService.count() and the same formatted pattern
otherwise) so the output exactly matches the specified contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2b845464-64f5-4ac4-a0aa-f5dbf6af1c47

📥 Commits

Reviewing files that changed from the base of the PR and between 5c833c0 and 9d8b476.

📒 Files selected for processing (2)
  • src/main/java/codes/yam/contacts/ContactController.java
  • src/main/java/codes/yam/contacts/ContactService.java

Comment thread src/main/java/codes/yam/contacts/ContactController.java
@yamcodes
yamcodes merged commit dc310aa into main Mar 21, 2026
4 checks passed
@yamcodes
yamcodes deleted the 7-add-contact-count-endpoint branch March 21, 2026 17:05
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.

Add contact count endpoint

1 participant