Skip to content

84 facade migration t3 course#131

Open
DjesikaV wants to merge 6 commits into
mainfrom
84-Facade-Migration-T3-course
Open

84 facade migration t3 course#131
DjesikaV wants to merge 6 commits into
mainfrom
84-Facade-Migration-T3-course

Conversation

@DjesikaV

Copy link
Copy Markdown
Contributor

Changes:

  • Added CourseWebFacade
  • Added CourseValidator
  • Updated CourseController to inject only the facade
  • Refactored CourseService to use only the repository
  • Moved @transactional from service to facade.
  • Updated CourseMapper
  • Removed validation annotations from CourseResponseDto
  • Added validation messages in CourseRequestDto
  • Updated CourseServiceTest
  • Added CourseWebFacadeTest
  • Added CourseValidatorTest

@DjesikaV
DjesikaV requested a review from a team as a code owner July 17, 2026 10:16
@GetMapping("/major/{majorId}")
public List<CourseResponseDto> getCoursesByMajorId(@PathVariable @NotNull final UUID majorId) {
return courseMapper.toResponseDtoList(courseService.findAllByMajorId(majorId));
public ResponseEntity<List<CourseResponseDto>> getCoursesByMajorId(@PathVariable @NotNull final UUID majorId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NotNull is not needed

@GetMapping("/{id}")
public ResponseEntity<CourseResponseDto> getMajorById(@PathVariable @NotNull final UUID id) {
return ResponseEntity.ok(courseMapper.toResponseDto(courseService.findCourseById(id)));
public ResponseEntity<CourseResponseDto> getCourseById(@PathVariable @NotNull final UUID id) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path variables cannot be null by default, remove the @Not null annotation in all the places where its not needed.

Comment on lines +18 to +24
public void validateForCreate(final CourseRequestDto requestDto) {
validateMajorExists(requestDto.majorId());
}

public void validateForUpdate(final CourseRequestDto requestDto) {
validateMajorExists(requestDto.majorId());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the validation logic for creation and updating is currently identical, we could combine them into a single method. DRY principle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants