From 508486cfdfff0c418828765e86bd1633cede8018 Mon Sep 17 00:00:00 2001 From: Luciano Belotto Date: Wed, 16 Oct 2024 14:57:45 -0400 Subject: [PATCH 1/4] 2024-10-16 - Create assignments upon creation of review-object --- .../services/reviews/ReviewAssignmentServices.java | 1 + .../reviews/ReviewAssignmentServicesImpl.java | 2 +- .../services/reviews/ReviewPeriodController.java | 12 ++++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServices.java b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServices.java index 5466fe01a..1e12e24da 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServices.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServices.java @@ -16,4 +16,5 @@ public interface ReviewAssignmentServices { void delete(UUID id); Set findAllByReviewPeriodIdAndReviewerId(UUID reviewPeriodId, @Nullable UUID reviewerId); + Set defaultReviewAssignments(UUID reviewPeriodId); } diff --git a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java index b731a4b16..ce74e89c6 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java @@ -109,7 +109,7 @@ public void delete(UUID id) { } } - private Set defaultReviewAssignments(UUID reviewPeriodId) { + public Set defaultReviewAssignments(UUID reviewPeriodId) { Set reviewAssignments = new HashSet<>(); memberProfileRepository.findAll().forEach(memberProfile -> { diff --git a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewPeriodController.java b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewPeriodController.java index e68811de3..66262a362 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewPeriodController.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewPeriodController.java @@ -33,9 +33,11 @@ public class ReviewPeriodController { private final ReviewPeriodServices reviewPeriodServices; + private final ReviewAssignmentServices reviewAssignmentServices; - public ReviewPeriodController(ReviewPeriodServices reviewPeriodServices) { + public ReviewPeriodController(ReviewPeriodServices reviewPeriodServices, ReviewAssignmentServices reviewAssignmentServices) { this.reviewPeriodServices = reviewPeriodServices; + this.reviewAssignmentServices = reviewAssignmentServices; } /** @@ -47,11 +49,17 @@ public ReviewPeriodController(ReviewPeriodServices reviewPeriodServices) { @Post @RequiredPermission(Permission.CAN_CREATE_REVIEW_PERIOD) public HttpResponse createReviewPeriod(@Body @Valid ReviewPeriodCreateDTO period, HttpRequest request) { + HttpResponse httpResponse; + Set reviewAssignments; + ReviewPeriod reviewPeriod = reviewPeriodServices.save(period.convertToEntity()); - return HttpResponse.created(reviewPeriod) + httpResponse = HttpResponse.created(reviewPeriod) .headers(headers -> headers .location(URI.create(String.format("%s/%s", request.getPath(), reviewPeriod.getId()))) ); + reviewAssignments = reviewAssignmentServices.defaultReviewAssignments(reviewPeriod.getId()); + reviewAssignmentServices.saveAll(reviewPeriod.getId(), reviewAssignments.stream().toList(), true); + return httpResponse; } /** From ccb71448a8d9e8708d56950ff82ffce5dae24735 Mon Sep 17 00:00:00 2001 From: Luciano Belotto Date: Wed, 16 Oct 2024 15:41:28 -0400 Subject: [PATCH 2/4] 2024-10-16 - Create assignments upon creation of review-object, and make it so the "findAll" will not return all members if member-list is empty --- .../services/reviews/ReviewAssignmentServicesImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java index ce74e89c6..08ae74353 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentServicesImpl.java @@ -82,10 +82,6 @@ public Set findAllByReviewPeriodIdAndReviewerId(UUID reviewPer } else { reviewAssignments = reviewAssignmentRepository.findByReviewPeriodIdAndReviewerId(reviewPeriodId, reviewerId); } - if (reviewAssignments.isEmpty()) { - //If no assignments exist for the review period, then a set of default review assignments should be returned - reviewAssignments = defaultReviewAssignments(reviewPeriodId); - } return reviewAssignments; } From d31d7996338a5eeb7627cd9d41840ec6d3314c73 Mon Sep 17 00:00:00 2001 From: Michael Kimberlin Date: Thu, 17 Oct 2024 10:22:39 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 94 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 92 deletions(-) diff --git a/README.md b/README.md index 5a35bce6d..0bf3e4b6d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Gradle Build & Deploy - Develop](https://github.com/objectcomputing/check-ins/actions/workflows/gradle-build-development.yml/badge.svg)](https://github.com/objectcomputing/check-ins/actions/workflows/gradle-build-development.yml) +[![Gradle Build & Deploy - Develop](https://github.com/objectcomputing/check-ins/actions/workflows/gradle-build-develop.yml/badge.svg)](https://github.com/objectcomputing/check-ins/actions/workflows/gradle-build-develop.yml) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) @@ -29,99 +29,9 @@ This web application is written in [Micronaut](https://micronaut.io) for uploadi See [Setting up your environment](https://objectcomputing.github.io/check-ins/getting-started/setup/) for instructions on setting up your development environment. -# Project setup - -There are two files required to run the application successfully. Both of which must be created and placed in -`src/main/resources/secrets`. - -### directory.json - -This is a simple JSON file containing the identifier for the Google Drive folder into which the uploaded files are to be deposited. - -```json -{ - "upload-directory-id": "GOOGLE_DRIVE_FOLDER_ID" -} -``` - -### credentials.json - -This JSON file should create the generated credentials for a service account that has access to write to the identified Google Drive folder. Information on configuring GCP service account credentials can be [found here](https://cloud.google.com/iam/docs/creating-managing-service-account-keys). - -Note: Be sure that the target Google Drive folder has edit access granted to the service account. - - - ## Running the application -#### Installs - -- [Podman](https://podman.io/) -- [Podman-Compose](https://github.com/containers/podman-compose) - -#### Building - -1. Start the database in a Podman container: - - Initialize and start a Podman VM: - ```shell - $ podman machine init - $ podman machine start - ``` - - Start the Podman container: - ```shell - $ podman-compose up - ``` -2. In a different terminal, execute the following commands : - - - On Bash/Zsh - - - ```sh - $ OAUTH_CLIENT_ID= OAUTH_CLIENT_SECRET= MICRONAUT_ENVIRONMENTS=local ./gradlew build - ``` - - ```sh - $ ./gradlew assemble - ``` - - ```sh - $ OAUTH_CLIENT_ID= OAUTH_CLIENT_SECRET= MICRONAUT_ENVIRONMENTS=local ./gradlew run - ``` - - - On Powershell/Command-Line - - Set the following environment variables - - ```sh - MICRONAUT_ENVIRONMENTS=local - OAUTH_CLIENT_ID= - OAUTH_CLIENT_SECRET= - ``` - Build and run the application - - ```sh - $ gradlew build - ``` - ```sh - $ gradlew assemble - ``` - ```sh - $ gradlew run - ``` - -3. Open the browser to run the application at `http://localhost:8080` -4. Access swagger-UI at - `http://localhost:8080/swagger-ui` - -# Testing - -1. To run the server tests, run the following: - ```sh - $ ./gradlew :server:check - ``` -2. To run the UI tests, run the following: - ```sh - $ ./gradlew :web-ui:check - ``` -3. To update snapshots, run the following: - ```sh - $ cd web-ui && yarn test -u - ``` +See [Running the Application](https://objectcomputing.github.io/check-ins/getting-started/running/) for instructions on running the application locally. # Contributing From e8b9a1f8d63476737c95adb4e87250f0aeb9cc2b Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Fri, 18 Oct 2024 07:23:55 -0500 Subject: [PATCH 4/4] Updated the review assignment controller test to reflect the latest change to the review period controller. --- .../reviews/ReviewAssignmentControllerTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/src/test/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentControllerTest.java b/server/src/test/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentControllerTest.java index 5bbd1a876..72e56caca 100644 --- a/server/src/test/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentControllerTest.java +++ b/server/src/test/java/com/objectcomputing/checkins/services/reviews/ReviewAssignmentControllerTest.java @@ -146,12 +146,13 @@ void testGETFindAssignmentsByPeriodIdDefaultAssignments() { final HttpResponse> response = client.toBlocking().exchange(request, Argument.setOf(ReviewAssignment.class)); + // A review period only has default review assignments added to it when + // the review period is created through the controller. And, they are + // no longer added to the review period when retrieving the review + // assignments for a specific review period. Therefore, this review + // period should have zero review assignments associated with it. assertNotNull(response.body()); - assertEquals(3, Objects.requireNonNull(response.body()).size()); - assertTrue(response.body().stream().anyMatch(ra -> ra.getRevieweeId().equals(memberOne.getId()))); - assertTrue(response.body().stream().anyMatch(ra -> ra.getRevieweeId().equals(memberTwo.getId()))); - assertTrue(response.body().stream().anyMatch(ra -> ra.getRevieweeId().equals(memberThree.getId()))); - assertEquals(HttpStatus.OK, response.getStatus()); + assertEquals(0, Objects.requireNonNull(response.body()).size()); } @Test @@ -287,4 +288,4 @@ void deleteReviewAssignmentWithoutPermissions() { assertNotNull(responseException.getResponse()); assertEquals(HttpStatus.FORBIDDEN, responseException.getStatus()); } -} \ No newline at end of file +}