diff --git a/src/main/java/yerong/wedle/category/announcement/controller/AdmissionAnnouncementApiController.java b/src/main/java/yerong/wedle/category/announcement/controller/AdmissionAnnouncementApiController.java deleted file mode 100644 index d33eec4..0000000 --- a/src/main/java/yerong/wedle/category/announcement/controller/AdmissionAnnouncementApiController.java +++ /dev/null @@ -1,56 +0,0 @@ -package yerong.wedle.category.announcement.controller; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -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.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import yerong.wedle.category.announcement.dto.AdmissionAnnouncementResponse; -import yerong.wedle.category.announcement.service.AdmissionAnnouncementService; - -import java.util.List; - -@Tag(name = "AdmissionAnnouncement API", description = "대학교 입시설명회 및 연계 활동 공지 관련 API") -@RequiredArgsConstructor -@RestController -@RequestMapping("/api/announcements") -public class AdmissionAnnouncementApiController { - - private final AdmissionAnnouncementService admissionAnnouncementService; - - - @Operation(summary = "대학별 공지사항 조회", description = "특정 대학의 ID를 사용하여 해당 대학과 관련된 모든 공지사항을 조회합니다.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "대학과 관련된 공지사항 조회 성공"), - @ApiResponse(responseCode = "404", description = "해당 대학을 찾을 수 없음") - }) - @GetMapping("/university/{universityId}") - public ResponseEntity> getAnnouncementsByUniversity(@PathVariable Long universityId) { - return ResponseEntity.ok().body(admissionAnnouncementService.getAnnouncementsByUniversity(universityId)); - } - - @Operation(summary = "카테고리별 공지사항 조회", description = "특정 카테고리를 사용하여 해당 카테고리에 속한 모든 공지사항을 조회합니다.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "카테고리별 공지사항 조회 성공"), - @ApiResponse(responseCode = "404", description = "해당 카테고리에 공지사항이 없음") - }) - @GetMapping("/category") - public ResponseEntity> getAnnouncementsByCategory(@RequestParam String category) { - return ResponseEntity.ok().body(admissionAnnouncementService.getAnnouncementsByCategory(category)); - } - - @Operation(summary = "모든 공지사항 조회", description = "모든 공지사항을 조회합니다.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "모든 공지사항 조회 성공") - }) - @GetMapping - public ResponseEntity> getAllAnnouncements() { - return ResponseEntity.ok().body(admissionAnnouncementService.getAllAnnouncements()); - } -} diff --git a/src/main/java/yerong/wedle/category/announcement/domain/AdmissionAnnouncement.java b/src/main/java/yerong/wedle/category/announcement/domain/AdmissionAnnouncement.java deleted file mode 100644 index 8d4ed1d..0000000 --- a/src/main/java/yerong/wedle/category/announcement/domain/AdmissionAnnouncement.java +++ /dev/null @@ -1,42 +0,0 @@ -package yerong.wedle.category.announcement.domain; - -import jakarta.persistence.*; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import yerong.wedle.university.domain.University; - -import java.util.Set; - -@Getter -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@Entity -public -class AdmissionAnnouncement { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "announcement_id") - private Long id; - - @Enumerated(EnumType.STRING) - @Column(nullable = false) - private AnnouncementCategory category; - - @Column(nullable = false) - private String title; - - @Column(nullable = false) - private String link; - - @Column - private String source; - - @ManyToMany - @JoinTable( - name = "announcement_university", - joinColumns = @JoinColumn(name = "announcement_id"), - inverseJoinColumns = @JoinColumn(name = "university_id") - ) - private Set relatedUniversities; -} diff --git a/src/main/java/yerong/wedle/category/announcement/dto/AdmissionAnnouncementResponse.java b/src/main/java/yerong/wedle/category/announcement/dto/AdmissionAnnouncementResponse.java deleted file mode 100644 index 6ed27f9..0000000 --- a/src/main/java/yerong/wedle/category/announcement/dto/AdmissionAnnouncementResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -package yerong.wedle.category.announcement.dto; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import yerong.wedle.category.announcement.domain.AnnouncementCategory; -import yerong.wedle.university.dto.UniversityResponse; - -import java.util.List; -import java.util.Set; - -@Getter -@AllArgsConstructor -@NoArgsConstructor -public class AdmissionAnnouncementResponse { - - private String category; - private String title; - private String link; - private String source; - private List relatedUniversityNames; -} diff --git a/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementCategoryNotFoundException.java b/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementCategoryNotFoundException.java deleted file mode 100644 index 61ab341..0000000 --- a/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementCategoryNotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package yerong.wedle.category.announcement.exception; - -import yerong.wedle.common.exception.CustomException; -import yerong.wedle.common.exception.ResponseCode; - -public class AdmissionAnnouncementCategoryNotFoundException extends CustomException { - public AdmissionAnnouncementCategoryNotFoundException() { - super(ResponseCode.ADMISSION_ANNOUNCEMENT_NOT_FOUND); - } -} diff --git a/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementNotFoundException.java b/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementNotFoundException.java deleted file mode 100644 index caccc40..0000000 --- a/src/main/java/yerong/wedle/category/announcement/exception/AdmissionAnnouncementNotFoundException.java +++ /dev/null @@ -1,10 +0,0 @@ -package yerong.wedle.category.announcement.exception; - -import yerong.wedle.common.exception.CustomException; -import yerong.wedle.common.exception.ResponseCode; - -public class AdmissionAnnouncementNotFoundException extends CustomException { - public AdmissionAnnouncementNotFoundException() { - super(ResponseCode.ADMISSION_ANNOUNCEMENT_NOT_FOUND); - } -} diff --git a/src/main/java/yerong/wedle/category/announcement/service/AdmissionAnnouncementService.java b/src/main/java/yerong/wedle/category/announcement/service/AdmissionAnnouncementService.java deleted file mode 100644 index 028c222..0000000 --- a/src/main/java/yerong/wedle/category/announcement/service/AdmissionAnnouncementService.java +++ /dev/null @@ -1,67 +0,0 @@ -package yerong.wedle.category.announcement.service; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import yerong.wedle.category.announcement.domain.AdmissionAnnouncement; -import yerong.wedle.category.announcement.domain.AnnouncementCategory; -import yerong.wedle.category.announcement.dto.AdmissionAnnouncementResponse; -import yerong.wedle.category.announcement.exception.AdmissionAnnouncementCategoryNotFoundException; -import yerong.wedle.category.announcement.exception.AdmissionAnnouncementNotFoundException; -import yerong.wedle.category.announcement.repository.AdmissionAnnouncementRepository; -import yerong.wedle.university.domain.University; -import yerong.wedle.university.dto.UniversityResponse; -import yerong.wedle.university.exception.UniversityNotFoundException; -import yerong.wedle.university.repository.UniversityRepository; - -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@RequiredArgsConstructor -@Service -@Transactional(readOnly = true) -public class AdmissionAnnouncementService { - - private final AdmissionAnnouncementRepository announcementRepository; - private final UniversityRepository universityRepository; - - - public List getAnnouncementsByUniversity(Long universityId) { - University university = universityRepository.findById(universityId) - .orElseThrow(UniversityNotFoundException::new); - return announcementRepository.findByRelatedUniversities(university).stream() - .map(this::convertToDto) - .collect(Collectors.toList()); - } - public List getAnnouncementsByCategory(String categoryDisplayName) { - AnnouncementCategory category = Arrays.stream(AnnouncementCategory.values()) - .filter(c -> c.getDisplayName().equals(categoryDisplayName)) - .findFirst() - .orElseThrow(AdmissionAnnouncementCategoryNotFoundException::new); - return announcementRepository.findByCategory(category).stream() - .map(this::convertToDto) - .collect(Collectors.toList()); - } - - public List getAllAnnouncements() { - return announcementRepository.findAll().stream() - .map(this::convertToDto) - .collect(Collectors.toList()); - } - - private AdmissionAnnouncementResponse convertToDto(AdmissionAnnouncement announcement) { - List relatedUniversityNames = announcement.getRelatedUniversities().stream() - .map(University::getName) - .collect(Collectors.toList()); - - return new AdmissionAnnouncementResponse( - announcement.getCategory().getDisplayName(), - announcement.getTitle(), - announcement.getLink(), - announcement.getSource(), - relatedUniversityNames - ); - } -} \ No newline at end of file diff --git a/src/main/java/yerong/wedle/category/expo/controller/ExpoApiController.java b/src/main/java/yerong/wedle/category/expo/controller/ExpoApiController.java new file mode 100644 index 0000000..b93b03b --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/controller/ExpoApiController.java @@ -0,0 +1,68 @@ +package yerong.wedle.category.expo.controller; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +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.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import yerong.wedle.category.expo.domain.ExpoStatus; +import yerong.wedle.category.expo.domain.ExpoType; +import yerong.wedle.category.expo.dto.ExpoResponse; +import yerong.wedle.category.expo.service.ExpoService; + +import java.util.List; + +@Tag(name = "Expo API", description = "대학교 입시설명회 및 연계 활동 공지 관련 API") +@RequiredArgsConstructor +@RestController +@RequestMapping("/api/expo") +public class ExpoApiController { + + private final ExpoService expoService; + + + @Operation(summary = "대학별 연계활동 조회", description = "특정 대학의 ID를 사용하여 해당 대학과 관련된 모든 공지사항을 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "대학과 관련된 공지사항 조회 성공"), + @ApiResponse(responseCode = "404", description = "해당 대학을 찾을 수 없음") + }) + @GetMapping("/search") + public ResponseEntity> getExposByUniversity(@RequestParam String keyword) { + return ResponseEntity.ok().body(expoService.getExposByKeyword(keyword)); + } + + @Operation(summary = "카테고리별 연계활동 조회", description = "특정 카테고리를 사용하여 해당 카테고리에 속한 모든 연계활동을 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "카테고리별 연계활동 조회 성공"), + @ApiResponse(responseCode = "404", description = "해당 카테고리에 연계활동이 없음") + }) + @GetMapping("/type") + public ResponseEntity> getExposByType(@RequestParam ExpoType type) { + return ResponseEntity.ok().body(expoService.getExposByType(type)); + } + + @Operation(summary = "상태별 연계활동 조회", description = "특정 카테고리를 사용하여 해당 카테고리에 속한 모든 연계활동을 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "카테고리별 연계활동 조회 성공"), + @ApiResponse(responseCode = "404", description = "해당 카테고리에 연계활동이 없음") + }) + @GetMapping("/status") + public ResponseEntity> getExposByStatus(@RequestParam ExpoStatus status) { + return ResponseEntity.ok().body(expoService.getExposByStatus(status)); + } + + @Operation(summary = "모든 연계활동 조회", description = "모든 연계활동을 조회합니다.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "모든 연계활동 조회 성공") + }) + @GetMapping + public ResponseEntity> getAllExpos() { + return ResponseEntity.ok().body(expoService.getAllExpos()); + } +} diff --git a/src/main/java/yerong/wedle/category/expo/domain/Expo.java b/src/main/java/yerong/wedle/category/expo/domain/Expo.java new file mode 100644 index 0000000..fdbf6db --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/domain/Expo.java @@ -0,0 +1,56 @@ +package yerong.wedle.category.expo.domain; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.cglib.core.Local; +import yerong.wedle.category.activity.domain.ActivityUniversity; +import yerong.wedle.university.domain.University; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +public +class Expo { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "expo_id") + private Long id; + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private ExpoType expoType; + + @Enumerated(EnumType.STRING) + @Column(nullable = false) + private ExpoStatus expoStatus; + + private String expoYear; + + @Column(nullable = false) + private String title; + + @Column(nullable = false) + private String link; + + private String location; + + @Column(columnDefinition = "TEXT") + private String content; + + private LocalDate startDate; + private LocalDate endDate; + + public void setExpoStatus(ExpoStatus expoStatus) { + this.expoStatus = expoStatus; + } +} diff --git a/src/main/java/yerong/wedle/category/expo/domain/ExpoStatus.java b/src/main/java/yerong/wedle/category/expo/domain/ExpoStatus.java new file mode 100644 index 0000000..0402a44 --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/domain/ExpoStatus.java @@ -0,0 +1,15 @@ +package yerong.wedle.category.expo.domain; + +import lombok.Getter; + +@Getter +public enum ExpoStatus { + OPEN("접수 중"), + CLOSED("접수 종료"); + + private final String displayName; + + ExpoStatus(String displayName) { + this.displayName = displayName; + } +} diff --git a/src/main/java/yerong/wedle/category/announcement/domain/AnnouncementCategory.java b/src/main/java/yerong/wedle/category/expo/domain/ExpoType.java similarity index 52% rename from src/main/java/yerong/wedle/category/announcement/domain/AnnouncementCategory.java rename to src/main/java/yerong/wedle/category/expo/domain/ExpoType.java index 9b00014..52a5ce2 100644 --- a/src/main/java/yerong/wedle/category/announcement/domain/AnnouncementCategory.java +++ b/src/main/java/yerong/wedle/category/expo/domain/ExpoType.java @@ -1,12 +1,14 @@ -package yerong.wedle.category.announcement.domain; +package yerong.wedle.category.expo.domain; -public enum AnnouncementCategory { +public enum ExpoType { ADMISSION_SESSION("입시설명회"), - COOPERATIVE_ACTIVITIES("연계활동"); + COOPERATIVE_ACTIVITIES("연계활동"), + MAJOR_EXPERIENCE("전공체험"); + private final String displayName; - AnnouncementCategory(String displayName) { + ExpoType(String displayName) { this.displayName = displayName; } diff --git a/src/main/java/yerong/wedle/category/expo/dto/ExpoResponse.java b/src/main/java/yerong/wedle/category/expo/dto/ExpoResponse.java new file mode 100644 index 0000000..dd11f6d --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/dto/ExpoResponse.java @@ -0,0 +1,24 @@ +package yerong.wedle.category.expo.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import yerong.wedle.category.expo.domain.Expo; + +import java.time.LocalDate; +import java.util.List; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public class ExpoResponse { + private Long expoId; + private String title; + private String category; + private String expoYear; + private String status; + private String link; + private String location; + private String content; + private String date; +} diff --git a/src/main/java/yerong/wedle/category/expo/exception/ExpoCategoryNotFoundException.java b/src/main/java/yerong/wedle/category/expo/exception/ExpoCategoryNotFoundException.java new file mode 100644 index 0000000..e95c12d --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/exception/ExpoCategoryNotFoundException.java @@ -0,0 +1,10 @@ +package yerong.wedle.category.expo.exception; + +import yerong.wedle.common.exception.CustomException; +import yerong.wedle.common.exception.ResponseCode; + +public class ExpoCategoryNotFoundException extends CustomException { + public ExpoCategoryNotFoundException() { + super(ResponseCode.EXPO_CATEGORY_NOT_FOUND); + } +} diff --git a/src/main/java/yerong/wedle/category/expo/exception/ExpoNotFoundException.java b/src/main/java/yerong/wedle/category/expo/exception/ExpoNotFoundException.java new file mode 100644 index 0000000..5f585cd --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/exception/ExpoNotFoundException.java @@ -0,0 +1,10 @@ +package yerong.wedle.category.expo.exception; + +import yerong.wedle.common.exception.CustomException; +import yerong.wedle.common.exception.ResponseCode; + +public class ExpoNotFoundException extends CustomException { + public ExpoNotFoundException() { + super(ResponseCode.EXPO_NOT_FOUND); + } +} diff --git a/src/main/java/yerong/wedle/category/expo/repository/ExpoRepository.java b/src/main/java/yerong/wedle/category/expo/repository/ExpoRepository.java new file mode 100644 index 0000000..ebffda8 --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/repository/ExpoRepository.java @@ -0,0 +1,23 @@ +package yerong.wedle.category.expo.repository; + + +import org.springframework.data.jpa.repository.JpaRepository; +import yerong.wedle.category.expo.domain.Expo; +import yerong.wedle.category.expo.domain.ExpoStatus; +import yerong.wedle.category.expo.domain.ExpoType; +import yerong.wedle.university.domain.University; + +import java.time.LocalDate; +import java.util.Arrays; +import java.util.List; + +public interface ExpoRepository extends JpaRepository { + + List findByExpoType(ExpoType type); + + List findByExpoStatus(ExpoStatus status); + + List findByEndDateBeforeAndExpoStatus(LocalDate today, ExpoStatus expoStatus); + + List findByContentContainingOrTitleContaining(String content, String title); +} diff --git a/src/main/java/yerong/wedle/category/expo/service/ExpoService.java b/src/main/java/yerong/wedle/category/expo/service/ExpoService.java new file mode 100644 index 0000000..d4faaf6 --- /dev/null +++ b/src/main/java/yerong/wedle/category/expo/service/ExpoService.java @@ -0,0 +1,76 @@ +package yerong.wedle.category.expo.service; + +import lombok.RequiredArgsConstructor; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import yerong.wedle.category.expo.domain.Expo; +import yerong.wedle.category.expo.domain.ExpoStatus; +import yerong.wedle.category.expo.domain.ExpoType; +import yerong.wedle.category.expo.dto.ExpoResponse; +import yerong.wedle.category.expo.repository.ExpoRepository; +import yerong.wedle.university.domain.University; +import yerong.wedle.university.repository.UniversityRepository; + +import java.time.LocalDate; +import java.util.List; +import java.util.stream.Collectors; + +@RequiredArgsConstructor +@Service +@Transactional(readOnly = true) +public class ExpoService { + + private final ExpoRepository expoRepository; + private final UniversityRepository universityRepository; + public List getExposByKeyword(String keyword) { + List expos = expoRepository.findByContentContainingOrTitleContaining(keyword, keyword); + + return expos.stream() + .map(this::convertToDto) + .collect(Collectors.toList()); + } + public List getExposByStatus(ExpoStatus status) { + return expoRepository.findByExpoStatus(status).stream() + .map(this::convertToDto) + .collect(Collectors.toList()); + } + public List getExposByType(ExpoType type) { + + return expoRepository.findByExpoType(type).stream() + .map(this::convertToDto) + .collect(Collectors.toList()); + } + + public List getAllExpos() { + return expoRepository.findAll().stream() + .map(this::convertToDto) + .collect(Collectors.toList()); + } + + + private ExpoResponse convertToDto(Expo expo) { + + return new ExpoResponse( + expo.getId(), + expo.getTitle(), + expo.getExpoType().getDisplayName(), + expo.getExpoYear(), + expo.getExpoStatus().getDisplayName(), + expo.getLink(), + expo.getLocation(), + expo.getContent(), + expo.getStartDate().toString() + " ~ " + expo.getEndDate().toString() + ); + } + @Scheduled(cron = "0 0 0 * * ?") + @Transactional + public void updateExpiredExposStatus() { + LocalDate today = LocalDate.now(); + List expiredExpos = expoRepository.findByEndDateBeforeAndExpoStatus(today, ExpoStatus.OPEN); + + for (Expo expo : expiredExpos) { + expo.setExpoStatus(ExpoStatus.CLOSED); + } + } +} \ No newline at end of file diff --git a/src/main/java/yerong/wedle/common/config/SchedulingConfig.java b/src/main/java/yerong/wedle/common/config/SchedulingConfig.java new file mode 100644 index 0000000..a95e0ee --- /dev/null +++ b/src/main/java/yerong/wedle/common/config/SchedulingConfig.java @@ -0,0 +1,9 @@ +package yerong.wedle.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; + +@Configuration +@EnableScheduling +public class SchedulingConfig { +} \ No newline at end of file diff --git a/src/main/java/yerong/wedle/common/exception/GlobalExceptionHandler.java b/src/main/java/yerong/wedle/common/exception/GlobalExceptionHandler.java index 163415f..9664831 100644 --- a/src/main/java/yerong/wedle/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/yerong/wedle/common/exception/GlobalExceptionHandler.java @@ -5,8 +5,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import yerong.wedle.calendar.exception.CalendarEventNotFoundException; -import yerong.wedle.category.announcement.exception.AdmissionAnnouncementCategoryNotFoundException; -import yerong.wedle.category.announcement.exception.AdmissionAnnouncementNotFoundException; +import yerong.wedle.category.expo.exception.ExpoCategoryNotFoundException; +import yerong.wedle.category.expo.exception.ExpoNotFoundException; import yerong.wedle.category.news.exception.NewsNotFoundException; import yerong.wedle.category.restaurant.exception.RestaurantNotFoundException; import yerong.wedle.competitionRate.exception.CompetitionRateNotFoundException; @@ -21,7 +21,6 @@ import yerong.wedle.star.exception.StarNotFoundException; import yerong.wedle.tuitionfee.exception.TuitionFeeNotFoundException; import yerong.wedle.university.exception.UniversityNotFoundException; -import yerong.wedle.admission.exception.AdmissionNotFoundException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -89,20 +88,20 @@ public ResponseEntity handleOAuthProcessingException(OAuthProcess ); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse); } - @ExceptionHandler(AdmissionAnnouncementNotFoundException.class) - public ResponseEntity handleAdmissionAnnouncementNotFoundException(AdmissionAnnouncementNotFoundException ex) { + @ExceptionHandler(ExpoCategoryNotFoundException.class) + public ResponseEntity handleExpoCategoryNotFoundException(ExpoCategoryNotFoundException ex) { ErrorResponse errorResponse = new ErrorResponse( - ResponseCode.ADMISSION_ANNOUNCEMENT_NOT_FOUND.getCode(), - ResponseCode.ADMISSION_ANNOUNCEMENT_NOT_FOUND.getMessage(), + ResponseCode.EXPO_CATEGORY_NOT_FOUND.getCode(), + ResponseCode.EXPO_CATEGORY_NOT_FOUND.getMessage(), LocalDateTime.now().format(FORMATTER) ); return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse); } - @ExceptionHandler(AdmissionAnnouncementCategoryNotFoundException.class) - public ResponseEntity handleAdmissionAnnouncementCategoryNotFoundException(AdmissionAnnouncementCategoryNotFoundException ex) { + @ExceptionHandler(ExpoNotFoundException.class) + public ResponseEntity handleExpoNotFoundException(ExpoNotFoundException ex) { ErrorResponse errorResponse = new ErrorResponse( - ResponseCode.ADMISSION_ANNOUNCEMENT_CATEGORY_NOT_FOUND.getCode(), - ResponseCode.ADMISSION_ANNOUNCEMENT_CATEGORY_NOT_FOUND.getMessage(), + ResponseCode.EXPO_NOT_FOUND.getCode(), + ResponseCode.EXPO_NOT_FOUND.getMessage(), LocalDateTime.now().format(FORMATTER) ); return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse); @@ -182,15 +181,6 @@ public ResponseEntity handleStarNotFoundException(StarNotFoundExc ); return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse); } - @ExceptionHandler(AdmissionNotFoundException.class) - public ResponseEntity handleAdmissionNotFoundException(AdmissionNotFoundException ex) { - ErrorResponse errorResponse = new ErrorResponse( - ResponseCode.ADMISSION_NOT_FOUND.getCode(), - ResponseCode.ADMISSION_NOT_FOUND.getMessage(), - LocalDateTime.now().format(FORMATTER) - ); - return ResponseEntity.status(HttpStatus.NOT_FOUND).body(errorResponse); - } @ExceptionHandler(DepartmentNotFoundException.class) public ResponseEntity handleDepartmentNotFoundException(DepartmentNotFoundException ex) { ErrorResponse errorResponse = new ErrorResponse( diff --git a/src/main/java/yerong/wedle/common/exception/ResponseCode.java b/src/main/java/yerong/wedle/common/exception/ResponseCode.java index 277d0f4..501a0cf 100644 --- a/src/main/java/yerong/wedle/common/exception/ResponseCode.java +++ b/src/main/java/yerong/wedle/common/exception/ResponseCode.java @@ -51,8 +51,8 @@ public enum ResponseCode { EMPLOYMENT_RATE_NOT_FOUND("404", "취업률 정보를 찾을 수 없습니다."), //Admission Announcement - ADMISSION_ANNOUNCEMENT_NOT_FOUND("404", "대학 연계 행사 정보를 찾을 수 없습니다."), - ADMISSION_ANNOUNCEMENT_CATEGORY_NOT_FOUND("404", "대학 연계 행사 카테고리 정보를 찾을 수 없습니다."); + EXPO_NOT_FOUND("404", "대학 연계 행사 정보를 찾을 수 없습니다."), + EXPO_CATEGORY_NOT_FOUND("404", "대학 연계 행사 카테고리 정보를 찾을 수 없습니다."); private final String code; diff --git a/src/main/java/yerong/wedle/university/domain/University.java b/src/main/java/yerong/wedle/university/domain/University.java index b784b18..52d65a2 100644 --- a/src/main/java/yerong/wedle/university/domain/University.java +++ b/src/main/java/yerong/wedle/university/domain/University.java @@ -3,7 +3,6 @@ import jakarta.persistence.*; import lombok.Getter; import yerong.wedle.category.activity.domain.ActivityUniversity; -import yerong.wedle.common.domain.BaseTimeEntity; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/yerong/wedle/university/repository/UniversityRepository.java b/src/main/java/yerong/wedle/university/repository/UniversityRepository.java index e6625ea..5987144 100644 --- a/src/main/java/yerong/wedle/university/repository/UniversityRepository.java +++ b/src/main/java/yerong/wedle/university/repository/UniversityRepository.java @@ -11,7 +11,5 @@ public interface UniversityRepository extends JpaRepository { List findByNameContainingOrLocationContaining(String name, String location); - Optional findByName(String universityName); - List findAllByOrderByNameAsc(); }