-
Notifications
You must be signed in to change notification settings - Fork 2
Poprawki strona projektu #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
...java/pl/edu/agh/project_manager/controller/dto/project/AssignmentsByEmployeeResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package pl.edu.agh.project_manager.controller.dto.project; | ||
|
|
||
| import pl.edu.agh.project_manager.domain.entity.project.ProjectAssignment; | ||
| import pl.edu.agh.project_manager.domain.entity.user.User; | ||
|
|
||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| public record AssignmentsByEmployeeResponse( | ||
| UUID userId, | ||
| String name, | ||
| String surname, | ||
| String email, | ||
| List<ProjectAssignmentResponse> assignments | ||
| ) { | ||
| public static AssignmentsByEmployeeResponse from(User user, List<ProjectAssignment> userAssignments) { | ||
| return new AssignmentsByEmployeeResponse( | ||
| user.getId(), | ||
| user.getName(), | ||
| user.getSurname(), | ||
| user.getEmail(), | ||
| userAssignments.stream() | ||
| .map(ProjectAssignmentResponse::from) | ||
| .toList() | ||
| ); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
...ain/java/pl/edu/agh/project_manager/controller/dto/project/ProjectAssignmentResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package pl.edu.agh.project_manager.controller.dto.project; | ||
|
|
||
| import pl.edu.agh.project_manager.domain.entity.project.ProjectAssignment; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.UUID; | ||
|
|
||
| public record ProjectAssignmentResponse( | ||
| UUID id, | ||
| LocalDate startDate, | ||
| LocalDate endDate, | ||
| AssignmentStatusResponse status, | ||
| String roleName, | ||
| int utilizationPercentage | ||
| ) { | ||
| public static ProjectAssignmentResponse from(ProjectAssignment assignment) { | ||
| return new ProjectAssignmentResponse( | ||
| assignment.getId(), | ||
| assignment.getStartDate(), | ||
| assignment.getEndDate(), | ||
| AssignmentStatusResponse.from(assignment.getStatus()), | ||
| assignment.getRoleName(), | ||
| assignment.getUtilizationPercentage() | ||
| ); | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
.../main/java/pl/edu/agh/project_manager/controller/dto/project/ProjectTimelineResponse.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package pl.edu.agh.project_manager.controller.dto.project; | ||
|
|
||
| import pl.edu.agh.project_manager.controller.dto.milestone.MilestoneResponse; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ProjectTimelineResponse( | ||
| List<MilestoneResponse> milestones, | ||
| List<AssignmentsByEmployeeResponse> assignments | ||
| ) { | ||
| } |
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co prawda to nie powstało w tym PR chyba, ale w sumie po co to AssignmentStatusResponse. AssignmentStatus to tylko enum i stworzenie response nie daje nam tu żadnych korzyści, a nawet przeszkadza, bo wymaga dodatkowego mapowania, zwróciłbym po prostu AssignmentStatus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tak, to nie powstało w ramach tego taska, skorzystałem z istniejącej struktury. Jestem zdania, że zawsze powinno się rozgraniczać te warstwy logiki, tzn
AssignmentStatusmimo, że wygląda identycznie to on dotyczy encji bazodanowych. Więc tak samo jak nie korzystamy z encji, to dla enuma również robimy osobne mapowanie, a szczególnie jest to zauważalne w momencie kiedy enum bazodanoway zaczyna rozjeżdżać się z tym co chcemy przekazać na frontend, np. zobacz różnicę międzyUserRoleorazAdminAssignableRoleto drugie nie ma w sobie admina.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tak ale AdminAssignableRole to enum, który do czegoś służy dodatkowo, czyli w tym wypadku nie chcemy zwracać Administrator, a tamto response to po prostu zduplikowany enum. Według mnie trochę przerost formy nad treścią, ale okej można zostawić.