Add New Fields and Ratings Section in Admin Dashboard.#68
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the admin dashboard and admin-facing APIs by adding rating statistics and introducing DTO-based responses for trips and payments, along with new admin listing endpoints to expose this data cleanly.
Changes:
- Added admin endpoints to list trips, payments, and ratings, and updated existing trip listing to return DTOs.
- Introduced
TripDto/PaymentDtomappings and a repository query to fetch trips with required associations. - Expanded dashboard stats (
DashboardDto+ service) to include rating count and average rating.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/yaquodorg/yaquod/service/trip/TripServiceImpl.java | Adds a service method to fetch trips with associations; sets endedAt when ending trips. |
| src/main/java/com/yaquodorg/yaquod/service/trip/TripService.java | Adds getAllTripsWithAssociations() to the service contract. |
| src/main/java/com/yaquodorg/yaquod/service/rating/RatingServiceImpl.java | Adds rating aggregate helpers (countRatings, averageRating). |
| src/main/java/com/yaquodorg/yaquod/service/rating/RatingService.java | Exposes rating aggregate helpers in the interface. |
| src/main/java/com/yaquodorg/yaquod/service/admin/DashboardServiceImpl.java | Adds rating totals/average into the dashboard stats output. |
| src/main/java/com/yaquodorg/yaquod/repository/TripRepository.java | Adds a fetch-join query to retrieve trips with associated entities. |
| src/main/java/com/yaquodorg/yaquod/repository/RatingRepository.java | Adds an aggregate query to compute average rating value. |
| src/main/java/com/yaquodorg/yaquod/dtos/admin/TripDto.java | Introduces an admin-facing TripDto with flattened relationship/location fields. |
| src/main/java/com/yaquodorg/yaquod/dtos/admin/PaymentDto.java | Introduces an admin-facing PaymentDto with flattened relationship fields. |
| src/main/java/com/yaquodorg/yaquod/dtos/admin/DashboardDto.java | Adds totalRatings and avgRating fields to the dashboard DTO. |
| src/main/java/com/yaquodorg/yaquod/controller/AdminController.java | Adds /trips, /payments, /ratings endpoints and switches user trips to DTO responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several new features and improvements to the admin and rating modules, focusing on enhanced data exposure for the admin dashboard and improved DTO usage. The main changes include the addition of DTOs for
TripandPayment, new admin endpoints for listing trips, payments, and ratings, and expanded dashboard statistics to include ratings data.Admin API Enhancements:
Added new endpoints to
AdminControllerto:TripDto(/admin/trips) [1] [2] [3].PaymentDto(/admin/payments) [1] [2]./admin/ratings).Updated existing endpoints to return DTOs instead of entities for improved API structure and decoupling (e.g.,
getUserTripsnow returnsTripDtoinstead ofTrip).Dashboard Statistics Improvements:
DashboardDtoand dashboard statistics to include:countRatingsandaverageRatingmethods inRatingServiceand its implementation, using a new repository query for average rating [1] [2] [3].DTO and Repository Additions:
TripDtoandPaymentDtowith static factory methods for mapping from entities [1] [2].Rating Service Refactoring:
toRatingResponsemapping method fromRatingServiceImplto theRatingServiceinterface, updating all usages accordingly [1] [2] [3] [4] [5] [6].RatingServiceintoAdminControllerandDashboardServiceImplfor new functionality [1] [2].These changes collectively improve the admin's ability to access and analyze trip, payment, and rating data, and modernize the API by introducing DTOs and more efficient data access patterns.