Skip to content

Add New Fields and Ratings Section in Admin Dashboard.#68

Merged
muhammadzkralla merged 7 commits into
developfrom
feature/dashboard
Jul 12, 2026
Merged

Add New Fields and Ratings Section in Admin Dashboard.#68
muhammadzkralla merged 7 commits into
developfrom
feature/dashboard

Conversation

@muhammadzkralla

Copy link
Copy Markdown
Member

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 Trip and Payment, new admin endpoints for listing trips, payments, and ratings, and expanded dashboard statistics to include ratings data.

Admin API Enhancements:

  • Added new endpoints to AdminController to:

    • List all trips with associated user, vehicle, payment, and request data using the new TripDto (/admin/trips) [1] [2] [3].
    • List all payments with user and trip associations using the new PaymentDto (/admin/payments) [1] [2].
    • List all ratings in the system (/admin/ratings).
  • Updated existing endpoints to return DTOs instead of entities for improved API structure and decoupling (e.g., getUserTrips now returns TripDto instead of Trip).

Dashboard Statistics Improvements:

  • Expanded DashboardDto and dashboard statistics to include:
    • Total number of ratings and average rating value [1] [2] [3].
  • Implemented countRatings and averageRating methods in RatingService and its implementation, using a new repository query for average rating [1] [2] [3].

DTO and Repository Additions:

  • Introduced TripDto and PaymentDto with static factory methods for mapping from entities [1] [2].
  • Added repository methods to efficiently fetch trips with all associations and to compute average rating [1] [2].

Rating Service Refactoring:

  • Moved the static toRatingResponse mapping method from RatingServiceImpl to the RatingService interface, updating all usages accordingly [1] [2] [3] [4] [5] [6].
  • Injected RatingService into AdminController and DashboardServiceImpl for 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.

Copilot AI 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.

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 / PaymentDto mappings 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.

Comment thread src/main/java/com/yaquodorg/yaquod/controller/AdminController.java
@muhammadzkralla
muhammadzkralla merged commit 94a3144 into develop Jul 12, 2026
1 check passed
@muhammadzkralla
muhammadzkralla deleted the feature/dashboard branch July 12, 2026 20:56
@muhammadzkralla
muhammadzkralla restored the feature/dashboard branch July 12, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants