-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(VIST-CPC-927): implementing aggregation and details page (#579)
JIRA:[ link to jira ticket](https://champlainsaintlambert.atlassian.net/browse/CPC-927) ## Context: Visits only had access to the petId and vetId. By aggregating it, we now have access to the needed vet information and pet information. There was also no details page for our visits. The user only had access to the general view which is a list. This also allows us to populate a details page with a single get method. ## Changes -Changed visitResponseDTO to now have the vet's full name and contact information as well as the pet's birth date and name. -Added navigation to Details Page -Added Details Page to the front-end UI CHANGES: **BEFORE:** ![image](https://github.com/cgerard321/champlain_petclinic/assets/92550620/b21ea8dd-876d-41b1-ae55-c9509b01ffde) **AFTER:** ![image](https://github.com/cgerard321/champlain_petclinic/assets/92550620/d61f8f3a-fe15-480e-aa19-c2faf76429de) DETAILS PAGE: ![image](https://github.com/cgerard321/champlain_petclinic/assets/92550620/5c98e72e-54ad-456a-a1d9-0791c04520ad)
- Loading branch information
1 parent
db3f4bc
commit bda738f
Showing
20 changed files
with
843 additions
and
224 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
7 changes: 7 additions & 0 deletions
7
api-gateway/src/main/resources/static/scripts/visit-details-info/visit.component.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
angular.module('visit') | ||
.component('visit', { | ||
templateUrl: 'scripts/visit-details-info/visit.details.template.html', | ||
controller: 'VisitController' | ||
}); |
10 changes: 10 additions & 0 deletions
10
api-gateway/src/main/resources/static/scripts/visit-details-info/visit.controller.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
angular.module('visit') | ||
.controller('VisitController', ['$http', '$stateParams', function ($http, $stateParams){ | ||
var self = this; | ||
|
||
$http.get('api/gateway/visits/' + $stateParams.visitId).then(function (resp) { | ||
self.visit = resp.data; | ||
}); | ||
|
||
|
||
}]) |
54 changes: 54 additions & 0 deletions
54
api-gateway/src/main/resources/static/scripts/visit-details-info/visit.details.template.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" rel="stylesheet"> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
|
||
<div class="container mt-5"> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<a class="btn btn-success" href="http://localhost:8080/#!/visitList">Back to Visits</a> | ||
</div> | ||
</div> | ||
<br> | ||
<div class="alert alert-danger" ng-if="$ctrl.visit.status === 'CANCELLED'"> | ||
NOTICE: This visit is cancelled. | ||
</div> | ||
<br> | ||
<div class="row"> | ||
<div class="col-md-4 text-start"> | ||
<h1 class="visit-title">VISIT(<span ng-style="{'color': $ctrl.visit.status === 'CANCELLED' ? 'red' : $ctrl.visit.status === 'UPCOMING' ? 'blue' : $ctrl.visit.status === 'CONFIRMED' ? 'green' : 'black'}">{{$ctrl.visit.status}}</span>)</h1> | ||
</div> | ||
<div class="col-md-4"></div> <!-- Empty column for spacing --> | ||
<div class="col-md-4 text-end"> | ||
<h3 class="visit-id">Visit ID: {{$ctrl.visit.visitId}}</h3> | ||
<h5>Date: {{$ctrl.visit.visitDate}}</h5> | ||
</div> | ||
<div class="col-md-4 text-start"> | ||
<h5>Visit Description: {{$ctrl.visit.description}}</h5> | ||
</div> | ||
</div> | ||
<hr> | ||
<div class="row g-5"> | ||
<div class="col-md-6"> | ||
<h3 class="text-center">Pet Information</h3> | ||
<h5>Pet ID: {{$ctrl.visit.petId}}</h5> | ||
<h5>Pet Name: {{$ctrl.visit.petName}} </h5> | ||
<h5>Birth Date: {{$ctrl.visit.petBirthDate | date: 'yyyy-MM-dd'}}</h5> | ||
<hr> | ||
<h3 class="text-center">Vet Information</h3> | ||
<h5>Vet ID: {{$ctrl.visit.practitionerId}}</h5> | ||
<h5>Vet Name: {{$ctrl.visit.vetFirstName}} {{$ctrl.visit.vetLastName}} </h5> | ||
<h5>Email: {{$ctrl.visit.vetEmail}}</h5> | ||
<h5>Phone Number: {{$ctrl.visit.vetPhoneNumber}}</h5> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
.visit-title, .visit-id { | ||
font-size: 24px; | ||
font-weight: bold; | ||
} | ||
</style> | ||
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script> |
11 changes: 11 additions & 0 deletions
11
api-gateway/src/main/resources/static/scripts/visit-details-info/visit.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
angular.module('visit', ['ui.router']) | ||
.config(['$stateProvider', function ($stateProvider) { | ||
$stateProvider | ||
.state('visitDetails', { | ||
parent: 'app', | ||
url: '/visit/:visitId/details', | ||
template: '<visit></visit>' | ||
}); | ||
}]); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import java.io.IOException; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Arrays; | ||
import java.util.Date; | ||
import java.util.Objects; | ||
import java.util.UUID; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
@@ -63,8 +64,34 @@ static void tearDown() throws IOException { | |
|
||
@Test | ||
void getAllVisits() throws JsonProcessingException { | ||
VisitResponseDTO visitResponseDTO = new VisitResponseDTO("73b5c112-5703-4fb7-b7bc-ac8186811ae1", LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), "this is a dummy description", "2", "2", Status.UPCOMING); | ||
VisitResponseDTO visitResponseDTO2 = new VisitResponseDTO("73b5c112-5703-4fb7-b7bc-ac8186811ae1", LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), "this is a dummy description", "2", "2", Status.UPCOMING); | ||
VisitResponseDTO visitResponseDTO = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
VisitResponseDTO visitResponseDTO2 = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
server.enqueue(new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) | ||
.setBody(objectMapper.writeValueAsString(Arrays.asList(visitResponseDTO, visitResponseDTO2))).addHeader("Content-Type", "application/json")); | ||
|
||
|
@@ -93,7 +120,20 @@ void getAllVisits_500Error()throws IllegalArgumentException{ | |
|
||
@Test | ||
void getVisitsForStatus() throws JsonProcessingException{ | ||
VisitResponseDTO visitResponseDTO = new VisitResponseDTO("773fa7b2-e04e-47b8-98e7-4adf7cfaaeee", LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), "this is a dummy description", "2", "2", Status.UPCOMING); | ||
VisitResponseDTO visitResponseDTO = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
server.enqueue(new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) | ||
.setBody(objectMapper.writeValueAsString(visitResponseDTO)).addHeader("Content-Type", "application/json")); | ||
|
||
|
@@ -114,14 +154,20 @@ void createVisitForPet_Valid() throws JsonProcessingException { | |
); | ||
|
||
// Mock the server response | ||
VisitResponseDTO visitResponseDTO = new VisitResponseDTO( | ||
"73b5c112-5703-4fb7-b7bc-ac8186811ae1", | ||
LocalDateTime.parse("2024-11-25 14:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), | ||
"Test Visit", | ||
"1", | ||
"2", | ||
Status.UPCOMING | ||
); | ||
VisitResponseDTO visitResponseDTO = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
server.enqueue(new MockResponse() | ||
.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) | ||
.setBody(objectMapper.writeValueAsString(visitResponseDTO)) | ||
|
@@ -248,7 +294,20 @@ void createVisitForPet_InvalidErrorResponse_ThrowsBadRequestException() throws J | |
|
||
@Test | ||
void getVisitsForPet() throws Exception { | ||
VisitResponseDTO visitResponseDTO = new VisitResponseDTO("773fa7b2-e04e-47b8-98e7-4adf7cfaaeee", LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), "this is a dummy description", "2", "2", Status.UPCOMING); | ||
VisitResponseDTO visitResponseDTO = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
server.enqueue(new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(objectMapper.writeValueAsString(visitResponseDTO)).addHeader("Content-Type", "application/json")); | ||
|
||
Flux<VisitResponseDTO> visits = visitsServiceClient.getVisitsForPet("2"); | ||
|
@@ -258,7 +317,21 @@ void getVisitsForPet() throws Exception { | |
} | ||
@Test | ||
void getVisitById() throws Exception { | ||
VisitResponseDTO visitResponseDTO = new VisitResponseDTO("773fa7b2-e04e-47b8-98e7-4adf7cfaaeee", LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")), "this is a dummy description", "2", "2", Status.UPCOMING); | ||
VisitResponseDTO visitResponseDTO = VisitResponseDTO.builder() | ||
.visitId("73b5c112-5703-4fb7-b7bc-ac8186811ae1") | ||
.visitDate(LocalDateTime.parse("2024-11-25 13:45", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))) | ||
.description("this is a dummy description") | ||
.petId("2") | ||
.petName("YourPetNameHere") | ||
.petBirthDate(new Date()) | ||
.practitionerId("2") | ||
.vetFirstName("VetFirstNameHere") | ||
.vetLastName("VetLastNameHere") | ||
.vetEmail("[email protected]") | ||
.vetPhoneNumber("123-456-7890") | ||
.status(Status.UPCOMING) | ||
.build(); | ||
|
||
server.enqueue(new MockResponse().setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE).setBody(objectMapper.writeValueAsString(visitResponseDTO)).addHeader("Content-Type", "application/json")); | ||
|
||
Mono<VisitResponseDTO> visitResponseDTOMono = visitsServiceClient.getVisitByVisitId("773fa7b2-e04e-47b8-98e7-4adf7cfaaeee"); | ||
|
Oops, something went wrong.