-
Notifications
You must be signed in to change notification settings - Fork 4
Development: Add research group info page
#662
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
43 commits
Select commit
Hold shift + click to select a range
6e86003
add research group component without logic
Bofan-Zhu 6c9fd52
adjust styling
Bofan-Zhu 7455a5a
Merge branch 'main' into 608-implement-research-group-page
Bofan-Zhu 2e9e383
add functionality
Bofan-Zhu ef22c78
remove unnecessary null checks and clean up dto
Bofan-Zhu 14e9905
clean up
Bofan-Zhu a7defbf
reduce dto
Bofan-Zhu c2fbd58
add non-empty validation and exception to dto
Bofan-Zhu 1f58e16
remove transactional
Bofan-Zhu 61803e6
add translate directive
Bofan-Zhu d1493b9
remove unnecessary fontawesome import
Bofan-Zhu 61b3424
fix types and improve naming of labels
Bofan-Zhu 0d5c362
add validation to required form fields
Bofan-Zhu d7ecd17
remove console logs
Bofan-Zhu cb57122
update dto constraints
Bofan-Zhu 29da683
restrain update rights
Bofan-Zhu 36c8902
add missing form field and remove id from dto
Bofan-Zhu 9bee41d
remove border and divider
Bofan-Zhu 11f67a9
add scss class
Bofan-Zhu 6f42666
add toast translations
Bofan-Zhu 1084e21
add valid check
Bofan-Zhu 42ec5c9
change sidebar icon, adjust translation
Bofan-Zhu eed83b6
change tab title
Bofan-Zhu 82df466
add email form validation
Bofan-Zhu f36dce6
Resolve merge conflict in ResearchGroupService.java
Bofan-Zhu 06f1274
re generate openapi
Bofan-Zhu 64d61c4
Merge branch 'main' into 608-implement-research-group-page
Bofan-Zhu eb91efe
add pageable to research group
Bofan-Zhu 4e3e95e
resolve error
Bofan-Zhu 57d369d
remove redundancy
Bofan-Zhu 67135ca
adjust styling
Bofan-Zhu 9d3a273
fix codacity
Bofan-Zhu b164378
add missing param tags according to javadoc
Bofan-Zhu 4856440
fix editor validation
Bofan-Zhu 560f4c3
fix input translation bug
Bofan-Zhu bb1840b
replace translation pipe
Bofan-Zhu d1386ce
Merge branch 'main' into 608-implement-research-group-page
Bofan-Zhu 42416a5
shorten toast errors
Bofan-Zhu 425681d
change description placeholder
Bofan-Zhu b10f05a
remove unused method
Bofan-Zhu a0d5a58
Merge branch 'main' into 608-implement-research-group-page
Bofan-Zhu e1631bb
resolve codacy
Bofan-Zhu bcf6e80
Merge branch '608-implement-research-group-page' of github.com:ls1int…
Bofan-Zhu 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
54 changes: 54 additions & 0 deletions
54
src/main/java/de/tum/cit/aet/usermanagement/dto/ResearchGroupDTO.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,54 @@ | ||
| package de.tum.cit.aet.usermanagement.dto; | ||
|
|
||
| import de.tum.cit.aet.core.exception.EntityNotFoundException; | ||
| import de.tum.cit.aet.usermanagement.domain.ResearchGroup; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
|
||
| import jakarta.validation.constraints.Email; | ||
| import jakarta.validation.constraints.NotBlank; | ||
|
|
||
| /** | ||
| * DTO for {@link ResearchGroup} | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
| public record ResearchGroupDTO( | ||
| @NotBlank String name, | ||
| String abbreviation, | ||
| @NotBlank String head, | ||
| @Email String email, | ||
| String website, | ||
| String school, | ||
| String description, | ||
| String defaultFieldOfStudies, | ||
| String street, | ||
| String postalCode, | ||
| String city | ||
| ) { | ||
|
|
||
| /** | ||
| * @param researchGroup the ResearchGroup entity | ||
| * @return the ResearchGroupDTO from the entity | ||
| * @throws EntityNotFoundException if the ResearchGroup entity is null | ||
| */ | ||
| public static ResearchGroupDTO getFromEntity(ResearchGroup researchGroup) { | ||
| if (researchGroup == null) { | ||
| throw new EntityNotFoundException("ResearchGroup entity should not be null"); | ||
| } | ||
|
|
||
| return new ResearchGroupDTO( | ||
| researchGroup.getName(), | ||
| researchGroup.getAbbreviation(), | ||
| researchGroup.getHead(), | ||
| researchGroup.getEmail(), | ||
| researchGroup.getWebsite(), | ||
| researchGroup.getSchool(), | ||
| researchGroup.getDescription(), | ||
| researchGroup.getDefaultFieldOfStudies(), | ||
| researchGroup.getStreet(), | ||
| researchGroup.getPostalCode(), | ||
| researchGroup.getCity() | ||
| ); | ||
| } | ||
|
|
||
| } | ||
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
70 changes: 60 additions & 10 deletions
70
src/main/java/de/tum/cit/aet/usermanagement/web/ResearchGroupResource.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 |
|---|---|---|
| @@ -1,28 +1,78 @@ | ||
| package de.tum.cit.aet.usermanagement.web; | ||
|
|
||
| import de.tum.cit.aet.core.dto.PageDTO; | ||
| import de.tum.cit.aet.core.dto.PageResponseDTO; | ||
| import de.tum.cit.aet.core.security.CheckAccess; | ||
| import de.tum.cit.aet.usermanagement.dto.ResearchGroupDTO; | ||
| import de.tum.cit.aet.usermanagement.dto.ResearchGroupLargeDTO; | ||
| import de.tum.cit.aet.usermanagement.service.ResearchGroupService; | ||
| import java.util.UUID; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| import org.springdoc.core.annotations.ParameterObject; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import de.tum.cit.aet.usermanagement.dto.ResearchGroupLargeDTO; | ||
| import de.tum.cit.aet.usermanagement.service.ResearchGroupService; | ||
| import jakarta.validation.Valid; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| /** | ||
| * REST controller for managing research groups. | ||
| */ | ||
| @RestController | ||
| @RequestMapping("/api/research-groups") | ||
| @RequiredArgsConstructor | ||
| public class ResearchGroupResource { | ||
|
|
||
| final ResearchGroupService researchGroupService; | ||
| private final ResearchGroupService researchGroupService; | ||
|
|
||
| public ResearchGroupResource(ResearchGroupService researchGroupService) { | ||
| this.researchGroupService = researchGroupService; | ||
| /** | ||
| * Get all research groups. | ||
| * | ||
| * @param pageDTO the pagination parameters | ||
| * @return the list of research groups | ||
| */ | ||
| @GetMapping | ||
| public ResponseEntity<PageResponseDTO<ResearchGroupDTO>> getAllResearchGroups(@ParameterObject @Valid @ModelAttribute PageDTO pageDTO) { | ||
| PageResponseDTO<ResearchGroupDTO> researchGroups = researchGroupService.getAllResearchGroups(pageDTO); | ||
| return ResponseEntity.ok(researchGroups); | ||
| } | ||
|
|
||
| /** | ||
| * Get a specific research group by ID. | ||
| * | ||
| * @param id the ID of the research group to retrieve | ||
| * @return the research group | ||
| */ | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<ResearchGroupDTO> getResearchGroup(@PathVariable UUID id) { | ||
| ResearchGroupDTO researchGroup = researchGroupService.getResearchGroup(id); | ||
| return ResponseEntity.ok(researchGroup); | ||
| } | ||
|
|
||
| /** | ||
| * Get detailed information about a research group. | ||
| * | ||
| * @param researchGroupId the ID of the research group to get details for | ||
| * @return the detailed research group information | ||
| */ | ||
| @GetMapping("/detail/{researchGroupId}") | ||
| public ResponseEntity<ResearchGroupLargeDTO> getResourceGroupDetails(@PathVariable UUID researchGroupId) { | ||
| return ResponseEntity.ok(researchGroupService.getResearchGroupDetails(researchGroupId)); | ||
| } | ||
|
|
||
| /** | ||
| * Update a research group. | ||
| * | ||
| * @param id the ID of the research group to update | ||
| * @param researchGroupDTO the research group data to update | ||
| * @return the updated research group | ||
| */ | ||
| @PutMapping("/{id}") | ||
| @CheckAccess | ||
| public ResponseEntity<ResearchGroupDTO> updateResearchGroup( | ||
| @PathVariable UUID id, | ||
|
Bofan-Zhu marked this conversation as resolved.
|
||
| @Valid @RequestBody ResearchGroupDTO researchGroupDTO | ||
| ) { | ||
| ResearchGroupDTO updatedResearchGroup = researchGroupService.updateResearchGroup(id, researchGroupDTO); | ||
| return ResponseEntity.ok(updatedResearchGroup); | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.