Skip to content

Feat/admin user rest api#98

Merged
kristinaxm merged 2 commits into
mainfrom
feat/admin-user-rest-api
Apr 22, 2026
Merged

Feat/admin user rest api#98
kristinaxm merged 2 commits into
mainfrom
feat/admin-user-rest-api

Conversation

@kristinaxm

@kristinaxm kristinaxm commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Added user lookup endpoints: retrieve a specific user by their ID or fetch all users assigned to a particular role.

@kristinaxm kristinaxm self-assigned this Apr 22, 2026
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The changes add comprehensive SLF4J logging to admin and user controller endpoints, modify the return type of getCurrentUser, inject a UserService dependency into UserController, and introduce two new endpoints for fetching users by ID and by role with associated error handling.

Changes

Cohort / File(s) Summary
Admin Logging
src/main/java/org/example/team6backend/admin/AdminController.java
Added request entry logs (including pagination and filtering parameters), result logs (entity counts and details), and action-completion logs across all admin endpoints. Inserted warning logs before exception-throwing scenarios (self role change, last admin removal, self-deactivation, self-deletion). Introduced local variables to capture service results for logging before mapping/return.
User Endpoint Enhancements
src/main/java/org/example/team6backend/user/controller/UserController.java
Modified getCurrentUser return type from UserResponse to ResponseEntity<UserResponse> with request logging. Added UserService dependency injection. Introduced GET /api/users/{userId} endpoint for single-user retrieval and GET /api/users/role/{role} endpoint for role-based user filtering, both with logging and error handling for invalid role conversion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Logs are hopping through the code so fine,
New endpoints bloom like carrots in a line,
AdminController sings with every trace,
While UserService finds its rightful place,
By role and ID, the data flows with grace! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
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.
Title check ❓ Inconclusive The title 'Feat/admin user rest api' is vague and uses a generic naming convention (Feat/...) without clearly describing what REST API functionality was actually added or changed. Revise the title to be more specific about the main change, such as 'Add comprehensive logging to admin endpoints and user lookup endpoints' or 'Extend user REST API with role-based filtering and detailed logging'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/admin-user-rest-api

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.

@kristinaxm
kristinaxm merged commit 127f6ee into main Apr 22, 2026
2 of 3 checks passed
@kristinaxm
kristinaxm deleted the feat/admin-user-rest-api branch April 23, 2026 17:30
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