Skip to content

Commit 610132e

Browse files
committed
feat(mentorship): add motivation field to mentorship requests and responseMessage to mentor responses; update request/response DTOs and related unit tests
1 parent 7aad1d4 commit 610132e

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

apps/jobboard-backend/src/main/java/org/bounswe/jobboardbackend/mentorship/controller/MentorshipController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ public ResponseEntity<List<MentorshipDetailsDTO>> getMyMentorshipDetails(
139139

140140

141141
@GetMapping("/requests/{requestId}")
142-
public ResponseEntity<MentorshipRequestDTO> getMentorshipRequest(
142+
public ResponseEntity<MentorshipRequestResponseDTO> getMentorshipRequest(
143143
@PathVariable Long requestId,
144144
Authentication auth
145145
) {
146146
UserDetailsImpl userDetails = (UserDetailsImpl) auth.getPrincipal();
147-
MentorshipRequestDTO request = mentorshipService.getMentorshipRequest(requestId, userDetails.getId());
147+
MentorshipRequestResponseDTO request = mentorshipService.getMentorshipRequest(requestId, userDetails.getId());
148148
return new ResponseEntity<>(request, HttpStatus.OK);
149149
}
150150

apps/jobboard-backend/src/main/java/org/bounswe/jobboardbackend/mentorship/service/MentorshipService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface MentorshipService {
2424
MentorshipRequestDTO createMentorshipRequest(CreateMentorshipRequestDTO requestDTO, Long jobSeekerId);
2525
MentorshipRequestResponseDTO respondToMentorshipRequest(Long requestId, RespondToRequestDTO respondToRequestDTO, Long mentorId);
2626
void rateMentor(CreateRatingDTO ratingDTO, Long jobSeekerId);
27-
MentorshipRequestDTO getMentorshipRequest(Long requestId, Long userId);
27+
MentorshipRequestResponseDTO getMentorshipRequest(Long requestId, Long userId);
2828
void completeMentorship(Long resumeReviewId, Authentication auth);
2929
void closeMentorship(Long resumeReviewId, Authentication auth);
3030
List<MentorshipRequestDTO> getMentorshipRequestsOfMentor(Long mentorId, Long userId);

apps/jobboard-backend/src/main/java/org/bounswe/jobboardbackend/mentorship/service/MentorshipServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public void rateMentor(CreateRatingDTO ratingDTO, Long jobSeekerId) {
342342

343343
@Override
344344
@Transactional(readOnly = true)
345-
public MentorshipRequestDTO getMentorshipRequest(Long requestId, Long userId) {
345+
public MentorshipRequestResponseDTO getMentorshipRequest(Long requestId, Long userId) {
346346

347347

348348

@@ -355,7 +355,7 @@ public MentorshipRequestDTO getMentorshipRequest(Long requestId, Long userId) {
355355
if (!userId.equals(mentorId) && !userId.equals(requesterId)) {
356356
throw new HandleException(ErrorCode.UNAUTHORIZED_REVIEW_ACCESS, "User is not authorized to see this request");
357357
}
358-
return toMentorshipRequestDTO(request);
358+
return toMentorshipRequestResponseDTO(request);
359359
}
360360

361361
@Override

apps/jobboard-backend/src/test/java/org/bounswe/jobboardbackend/mentorship/controller/MentorshipControllerTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,20 @@ void getMentorshipRequest_usesAuthenticatedUserId() {
264264
when(auth.getPrincipal()).thenReturn(principal);
265265
when(principal.getId()).thenReturn(99L);
266266

267-
MentorshipRequestDTO dto = new MentorshipRequestDTO(
267+
MentorshipRequestResponseDTO dto = new MentorshipRequestResponseDTO(
268268
"50",
269269
"10",
270270
"99",
271271
"PENDING",
272272
LocalDateTime.now(),
273-
"Because I want to learn"
273+
"Because I want to learn",
274+
""
274275
);
275276

276277
when(mentorshipService.getMentorshipRequest(requestId, 99L))
277278
.thenReturn(dto);
278279

279-
ResponseEntity<MentorshipRequestDTO> response =
280+
ResponseEntity<MentorshipRequestResponseDTO> response =
280281
mentorshipController.getMentorshipRequest(requestId, auth);
281282

282283
assertEquals(HttpStatus.OK, response.getStatusCode());

0 commit comments

Comments
 (0)