diff --git a/docker-compose.yml b/docker-compose.yml index f662567..298f729 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,23 +20,23 @@ services: networks: - alchive - springboot: - container_name: springboot - build: - context: . - dockerfile: Dockerfile - restart: always - depends_on: - - mysql - ports: - - "8080:8080" - environment: - SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} - SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} - SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} - SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} - networks: - - alchive + # springboot: + # container_name: springboot + # build: + # context: . + # dockerfile: Dockerfile + # restart: always + # depends_on: + # - mysql + # ports: + # - "8080:8080" + # environment: + # SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} + # SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} + # SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} + # SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} + # networks: + # - alchive # Monitoring prometheus: diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml index 1cff57b..8733a86 100644 --- a/monitoring/prometheus/prometheus.yml +++ b/monitoring/prometheus/prometheus.yml @@ -5,7 +5,8 @@ scrape_configs: - job_name: 'springboot' # 스프링부트 애플리케이션 모니터링 metrics_path: '/actuator/prometheus' static_configs: - - targets: [ 'springboot:8080' ] # springboot 서비스의 주소 + # - targets: [ 'springboot:8080' ] # springboot 서비스의 주소 + - targets: [ 'localhost:8080' ] # springboot 서비스의 주소 (로컬) - job_name: 'cadvisor' # cAdvisor 모니터링 static_configs: diff --git a/src/main/java/com/Alchive/backend/config/DataInitializer.java b/src/main/java/com/Alchive/backend/config/DataInitializer.java index c375613..81043cc 100644 --- a/src/main/java/com/Alchive/backend/config/DataInitializer.java +++ b/src/main/java/com/Alchive/backend/config/DataInitializer.java @@ -27,7 +27,6 @@ public class DataInitializer implements CommandLineRunner { private final SolutionRepository solutionRepository; private final BoardRepository boardRepository; private final AlgorithmRepository algorithmRepository; - private final AlgorithmProblemRepository algorithmProblemRepository; public DataInitializer(UserRepository userRepository, ProblemRepository problemRepository, @@ -40,7 +39,6 @@ public DataInitializer(UserRepository userRepository, this.solutionRepository = solutionRepository; this.boardRepository = boardRepository; this.algorithmRepository = algorithmRepository; - this.algorithmProblemRepository = algorithmProblemRepository; } @Override @@ -51,7 +49,7 @@ public void run(String... args) throws Exception { log.info("데이터가 이미 존재하므로 초기화 작업을 건너뜁니다."); return; } - + // User 목업 데이터 생성 User user1 = User.builder() .userEmail("chohana@alchive.com") diff --git a/src/main/java/com/Alchive/backend/controller/BoardController.java b/src/main/java/com/Alchive/backend/controller/BoardController.java index 583c5a9..2ef8568 100644 --- a/src/main/java/com/Alchive/backend/controller/BoardController.java +++ b/src/main/java/com/Alchive/backend/controller/BoardController.java @@ -3,7 +3,6 @@ import com.Alchive.backend.config.result.ResultResponse; import com.Alchive.backend.dto.request.BoardCreateRequest; import com.Alchive.backend.dto.request.BoardMemoUpdateRequest; -import com.Alchive.backend.dto.request.PaginationRequest; import com.Alchive.backend.dto.request.ProblemNumberRequest; import com.Alchive.backend.dto.response.BoardDetailResponseDTO; import com.Alchive.backend.dto.response.BoardResponseDTO; @@ -46,8 +45,10 @@ public ResponseEntity isBoardSaved(HttpServletRequest tokenReque @Operation(summary = "게시물 목록 조회", description = "게시물 목록을 조회하는 메서드입니다. ") @GetMapping("") - public ResponseEntity getBoardList(@ModelAttribute PaginationRequest paginationRequest) { - Page> boardList = boardService.getBoardList(paginationRequest); + public ResponseEntity getBoardList(@RequestParam(value = "offset", defaultValue = "0") int offset, + @RequestParam(value = "limit", defaultValue = "10") int limit) { + log.info("paginationRequest: {}, {}", offset, limit); + Page> boardList = boardService.getBoardList(offset, limit); return ResponseEntity.ok(ResultResponse.of(BOARD_LIST_INFO_SUCCESS, boardList)); } diff --git a/src/main/java/com/Alchive/backend/dto/request/PaginationRequest.java b/src/main/java/com/Alchive/backend/dto/request/PaginationRequest.java deleted file mode 100644 index 8cc932f..0000000 --- a/src/main/java/com/Alchive/backend/dto/request/PaginationRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.Alchive.backend.dto.request; - -import lombok.Getter; -import lombok.NoArgsConstructor; - -@NoArgsConstructor -@Getter -public class PaginationRequest { - private int offset = 0; - private int limit = 20; -} diff --git a/src/main/java/com/Alchive/backend/service/BoardService.java b/src/main/java/com/Alchive/backend/service/BoardService.java index c618a99..88c792d 100644 --- a/src/main/java/com/Alchive/backend/service/BoardService.java +++ b/src/main/java/com/Alchive/backend/service/BoardService.java @@ -10,7 +10,10 @@ import com.Alchive.backend.domain.problem.Problem; import com.Alchive.backend.domain.solution.Solution; import com.Alchive.backend.domain.user.User; -import com.Alchive.backend.dto.request.*; +import com.Alchive.backend.dto.request.BoardCreateRequest; +import com.Alchive.backend.dto.request.BoardMemoUpdateRequest; +import com.Alchive.backend.dto.request.ProblemCreateRequest; +import com.Alchive.backend.dto.request.ProblemNumberRequest; import com.Alchive.backend.dto.response.BoardDetailResponseDTO; import com.Alchive.backend.dto.response.BoardResponseDTO; import com.Alchive.backend.dto.response.ProblemResponseDTO; @@ -65,8 +68,9 @@ public BoardDetailResponseDTO isBoardSaved(HttpServletRequest tokenRequest, Prob return board.map(this::toBoardDetailResponseDTO).orElse(null); } - public Page> getBoardList(PaginationRequest paginationRequest) { - Pageable pageable = PageRequest.of(paginationRequest.getOffset(), paginationRequest.getLimit()); + public Page> getBoardList(int offset, int limit) { + Pageable pageable = PageRequest.of(offset, limit); + log.info("pageable: {}", pageable); Page boardPage = boardRepository.findAll(pageable); // Board를 BoardDetailResponseDTO로 변환