Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.back.catchmate.domain.enroll.controller;

import com.back.catchmate.domain.enroll.dto.EnrollRequest.CreateEnrollRequest;
import com.back.catchmate.domain.enroll.dto.EnrollResponse;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CancelEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CreateEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.EnrollDescriptionInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.NewEnrollCountInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.PagedEnrollReceiveInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.PagedEnrollRequestInfo;
Expand Down Expand Up @@ -95,4 +97,11 @@ public UpdateEnrollInfo rejectEnroll(@PathVariable Long enrollId,
@JwtValidation Long userId) throws IOException {
return enrollService.rejectEnroll(enrollId, userId);
}

@GetMapping("/{enrollId}/description")
@Operation(summary = "보낸 신청 상세 조회 API", description = "보낸 신청의 상세 내용을 조회하는 API 입니다.")
public EnrollDescriptionInfo getEnrollDescriptionById(@PathVariable Long enrollId,
@JwtValidation Long userId) {
return enrollService.getEnrollDescriptionById(enrollId, userId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.back.catchmate.domain.enroll.dto.EnrollResponse;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CancelEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CreateEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.EnrollDescriptionInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.EnrollReceiveInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.EnrollRequestInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.NewEnrollCountInfo;
Expand Down Expand Up @@ -143,4 +144,10 @@ public UpdateEnrollInfo toUpdateEnrollInfo(Enroll enroll, AcceptStatus acceptSta
.acceptStatus(acceptStatus)
.build();
}

public EnrollDescriptionInfo toEnrollDescriptionInfo(Enroll enroll) {
return EnrollDescriptionInfo.builder()
.description(enroll.getDescription())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,12 @@ public static class CancelEnrollInfo {
private Long enrollId;
private LocalDateTime deletedAt;
}

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class EnrollDescriptionInfo {
private String description;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.back.catchmate.domain.enroll.service;

import com.back.catchmate.domain.enroll.dto.EnrollRequest.CreateEnrollRequest;
import com.back.catchmate.domain.enroll.dto.EnrollResponse;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CancelEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CreateEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.EnrollDescriptionInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.NewEnrollCountInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.PagedEnrollReceiveInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.PagedEnrollRequestInfo;
Expand All @@ -27,4 +29,6 @@ public interface EnrollService {
UpdateEnrollInfo acceptEnroll(Long enrollId, Long userId) throws IOException;

UpdateEnrollInfo rejectEnroll(Long enrollId, Long userId) throws IOException;

EnrollDescriptionInfo getEnrollDescriptionById(Long enrollId, Long userId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.back.catchmate.domain.chat.repository.UserChatRoomRepository;
import com.back.catchmate.domain.enroll.converter.EnrollConverter;
import com.back.catchmate.domain.enroll.dto.EnrollRequest.CreateEnrollRequest;
import com.back.catchmate.domain.enroll.dto.EnrollResponse;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CancelEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.CreateEnrollInfo;
import com.back.catchmate.domain.enroll.dto.EnrollResponse.NewEnrollCountInfo;
Expand Down Expand Up @@ -229,4 +230,15 @@ public UpdateEnrollInfo rejectEnroll(Long enrollId, Long userId) throws IOExcept
enroll.respondToEnroll(AcceptStatus.REJECTED);
return enrollConverter.toUpdateEnrollInfo(enroll, AcceptStatus.REJECTED);
}

@Override
public EnrollResponse.EnrollDescriptionInfo getEnrollDescriptionById(Long enrollId, Long userId) {
User user = userRepository.findById(userId)
.orElseThrow(() -> new BaseException(ErrorCode.USER_NOT_FOUND));

Enroll enroll = enrollRepository.findById(enrollId)
.orElseThrow(() -> new BaseException(ErrorCode.ENROLL_NOT_FOUND));

return enrollConverter.toEnrollDescriptionInfo(enroll);
}
}