Open AhmedAbouseda1 opened 6 months ago
072b9c7859
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
src/main/java/com/kpis/helper/service/dto/DashboardDTO.java
✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 Edit
Create src/main/java/com/kpis/helper/service/dto/DashboardDTO.java with contents: Create a new `DashboardDTO` class in the `com.kpis.helper.service.dto` package with the following fields:
private Long collectionSize;
private Instant collectionRecordedDate;
private Instant activitiesRecordedDate;
private Long totalActivities;
private Long totalParticipants;
Generate getters and setters for these fields.
src/main/java/com/kpis/helper/repository/ActivitiesRepository.java
✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 Edit
Modify src/main/java/com/kpis/helper/repository/ActivitiesRepository.java with contents: Create a new `ActivitiesRepository` interface in the `com.kpis.helper.repository` package that extends `JpaRepository`.
Add the following query method to retrieve the most recent recorded date:
@Query("select max(a.recordedDate) from Activities a")
Instant findMaxRecordedDate();
src/main/java/com/kpis/helper/service/CollectionService.java
✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 Edit
Modify src/main/java/com/kpis/helper/service/CollectionService.java with contents:
Add a new method to retrieve the dashboard data at the end of the CollectionService
class:
src/main/java/com/kpis/helper/web/rest/CollectionResource.java
✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 Edit
Modify src/main/java/com/kpis/helper/web/rest/CollectionResource.java with contents: Inject the `ActivitiesRepository` and add a new endpoint method to retrieve the dashboard data:
I have finished reviewing the code for completeness. I did not find errors for sweep/create_dashboard_endpoint
.
💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.
This is an automated message generated by Sweep AI.
I want to create backend dashboard API, it should return the following dto get the collection size and the recorded date from collection entity and recorded_date ,total_activities, total_participants from activities entity the entities called collection and activities the endpoints should be allocated under com.kpis.helper.web.rest RequestMapping should be "/api/dashboard"
Checklist
- [X] Create `src/main/java/com/kpis/helper/service/dto/DashboardDTO.java` ✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 [Edit](https://github.com/AhmedAbouseda1/kpishelper/edit/sweep/create_dashboard_endpoint/src/main/java/com/kpis/helper/service/dto/DashboardDTO.java) - [X] Modify `src/main/java/com/kpis/helper/repository/ActivitiesRepository.java` ✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 [Edit](https://github.com/AhmedAbouseda1/kpishelper/edit/sweep/create_dashboard_endpoint/src/main/java/com/kpis/helper/repository/ActivitiesRepository.java) - [X] Modify `src/main/java/com/kpis/helper/service/CollectionService.java` ✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 [Edit](https://github.com/AhmedAbouseda1/kpishelper/edit/sweep/create_dashboard_endpoint/src/main/java/com/kpis/helper/service/CollectionService.java) - [X] Modify `src/main/java/com/kpis/helper/web/rest/CollectionResource.java` ✓ https://github.com/AhmedAbouseda1/kpishelper/commit/793adc9f93ffddd134b14e03beaee34ef8a0c721 [Edit](https://github.com/AhmedAbouseda1/kpishelper/edit/sweep/create_dashboard_endpoint/src/main/java/com/kpis/helper/web/rest/CollectionResource.java)