From 5c0f545eeb2b17751fb78e7056d038aa3571b76a Mon Sep 17 00:00:00 2001 From: YunJaeHoon Date: Mon, 23 Dec 2024 23:22:06 +0900 Subject: [PATCH] =?UTF-8?q?DEL:=20=EA=B0=95=EC=9D=98=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EB=B0=8F=20=EC=9E=A5=EC=86=8C=20=EB=8F=99=EA=B8=B0=ED=99=94?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EC=9E=84=EC=8B=9C=20api=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminController.java | 24 --------------- .../Devkor_project/service/AdminService.java | 29 ------------------- 2 files changed, 53 deletions(-) diff --git a/src/main/java/com/example/Devkor_project/controller/AdminController.java b/src/main/java/com/example/Devkor_project/controller/AdminController.java index a6169f6..69c9c68 100644 --- a/src/main/java/com/example/Devkor_project/controller/AdminController.java +++ b/src/main/java/com/example/Devkor_project/controller/AdminController.java @@ -206,28 +206,4 @@ public ResponseEntity createTestAccount(@Valid @RequestBody .build() ); } - - /* 강의 시간 및 장소 정보 동기화 컨트톨러 */ - @PostMapping("/api/admin/course-time-location-synchronization") - @Operation(summary = "강의 시간 및 장소 정보 동기화") - @Parameters(value = { - @Parameter(in = ParameterIn.HEADER, name = "Authorization", description = "Bearer {access token}"), - }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200"), - }) - public ResponseEntity checkTimeLocationSynchronization(@Valid @RequestBody CrawlingDto.Synchronization dto) - { - adminService.checkTimeLocationSynchronization(dto); - - return ResponseEntity.status(HttpStatus.OK) - .body( - ResponseDto.Success.builder() - .message("강의 시간 및 장소 동기화를 성공적으로 수행하였습니다.") - .data(null) - .version(versionProvider.getVersion()) - .build() - ); - } - } diff --git a/src/main/java/com/example/Devkor_project/service/AdminService.java b/src/main/java/com/example/Devkor_project/service/AdminService.java index f8501f8..d6a1975 100644 --- a/src/main/java/com/example/Devkor_project/service/AdminService.java +++ b/src/main/java/com/example/Devkor_project/service/AdminService.java @@ -403,33 +403,4 @@ public void createTestAccount(ProfileDto.CreateTestAccount dto) // 해당 엔티티를 데이터베이스에 저장 profileRepository.save(profile); } - - /* 강의 시간 및 장소 동기화 서비스 */ - @Transactional - public void checkTimeLocationSynchronization(CrawlingDto.Synchronization dto) - { - // 현재 데이터베이스에 존재하는 해당 연도와 학기의 모든 강의 정보 - List allCourseInDatabase = courseRepository.findCourseByYearAndSemester(dto.getYear(), dto.getSemester()); - - for(Course course:allCourseInDatabase) - { - // 해당 강의의 time_location 정보를 CourseDto.TimeLocation 리스트로 변환 - List timeLocations = parseTimeLocation(course.getTime_location()); - - // TimeLocation 엔티티 추가 - if (timeLocations != null && !timeLocations.isEmpty()) { - for (CourseDto.TimeLocation timeLocationDto : timeLocations) { - TimeLocation timeLocation = TimeLocation.builder() - .course_id(course) - .day(timeLocationDto.getDay()) - .startPeriod(timeLocationDto.getStartPeriod()) - .endPeriod(timeLocationDto.getEndPeriod()) - .location(timeLocationDto.getLocation()) - .build(); - - timeLocationRepository.save(timeLocation); - } - } - } - } }