diff --git a/README.md b/README.md index 6a823dc2..4d3e939a 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,9 @@ VECO는 **AI를 활용해 분산된 정보를 한곳에 모으고, 목표를 명 - 마크/김주헌: 목표, Slack 연동 --- ## 🛜 서버 현황 -스크린샷 2025-08-09 04 46 30 +476164894-f109d3c6-85dd-4725-9ae0-59a8ef432026 - main-develop 브랜치 구조에 따라 배포환경, 개발환경을 따로 구성 - 개발 환경(localhost:5173)과 배포 환경(web.vecoservice.shop)간 테스트를 진행 - 추후, 서버를 통합 관리해 무중단 배포 전략(블루-그린) 사용 + diff --git a/src/main/java/com/example/Veco/domain/comment/controller/CommentController.java b/src/main/java/com/example/Veco/domain/comment/controller/CommentController.java index cb023157..55928782 100644 --- a/src/main/java/com/example/Veco/domain/comment/controller/CommentController.java +++ b/src/main/java/com/example/Veco/domain/comment/controller/CommentController.java @@ -2,6 +2,7 @@ import com.example.Veco.domain.comment.dto.request.CommentCreateDTO; import com.example.Veco.domain.comment.dto.response.CommentListResponseDTO; +import com.example.Veco.domain.comment.dto.response.CommentResponseDTO; import com.example.Veco.domain.comment.service.CommentService; import com.example.Veco.global.apiPayload.ApiResponse; import com.example.Veco.global.enums.Category; @@ -72,7 +73,7 @@ public ApiResponse createComment( ) }) @GetMapping - public ApiResponse getAllComments( + public ApiResponse getAllComments( @Parameter(description = "댓글을 조회할 대상 리소스의 ID", required = true, example = "1") @RequestParam("targetId") Long targetId, @Parameter(description = "리소스 카테고리 (ISSUE, GOAL, EXTERNAL)", required = true, example = "ISSUE") diff --git a/src/main/java/com/example/Veco/domain/comment/converter/CommentConverter.java b/src/main/java/com/example/Veco/domain/comment/converter/CommentConverter.java index a82aab6d..23764251 100644 --- a/src/main/java/com/example/Veco/domain/comment/converter/CommentConverter.java +++ b/src/main/java/com/example/Veco/domain/comment/converter/CommentConverter.java @@ -2,6 +2,7 @@ import com.example.Veco.domain.comment.dto.request.CommentCreateDTO; import com.example.Veco.domain.comment.dto.response.CommentListResponseDTO; +import com.example.Veco.domain.comment.dto.response.CommentResponseDTO; import com.example.Veco.domain.comment.entity.Comment; import com.example.Veco.domain.comment.entity.CommentRoom; import com.example.Veco.domain.member.entity.Member; @@ -22,30 +23,26 @@ public static Comment toComment(CommentCreateDTO commentCreateDTO, CommentRoom c return comment; } - public static CommentListResponseDTO toCommentResponseDTO(List comments) { + public static CommentResponseDTO.CommentListDTO toCommentListDTO(List comments) { - List commentResponseDTOS = new ArrayList<>(); + List commentInfoDTOS = new ArrayList<>(); comments.forEach(comment -> { - CommentListResponseDTO.AuthorResponseDTO authorDTO = CommentListResponseDTO.AuthorResponseDTO.builder() - .authorId(comment.getMember().getId()) - .authorName(comment.getMember().getName()) - .profileImageUrl(comment.getMember().getProfile().getProfileImageUrl()) - .build(); - CommentListResponseDTO.CommentResponseDTO commentDTO = CommentListResponseDTO.CommentResponseDTO.builder() - .commentId(comment.getId()) + CommentResponseDTO.CommentInfoDTO commentDTO = CommentResponseDTO.CommentInfoDTO.builder() + .id(comment.getId()) .content(comment.getContent()) - .author(authorDTO) .createdAt(comment.getCreatedAt()) + .name(comment.getMember().getName()) + .profileUrl(comment.getMember().getProfile().getProfileImageUrl()) .build(); - commentResponseDTOS.add(commentDTO); + commentInfoDTOS.add(commentDTO); }); - return CommentListResponseDTO.builder() - .comments(commentResponseDTOS) - .totalSize(comments.size()) + return CommentResponseDTO.CommentListDTO.builder() + .cnt(commentInfoDTOS.size()) + .info(commentInfoDTOS) .build(); } } diff --git a/src/main/java/com/example/Veco/domain/comment/dto/response/CommentResponseDTO.java b/src/main/java/com/example/Veco/domain/comment/dto/response/CommentResponseDTO.java new file mode 100644 index 00000000..154b569d --- /dev/null +++ b/src/main/java/com/example/Veco/domain/comment/dto/response/CommentResponseDTO.java @@ -0,0 +1,34 @@ +package com.example.Veco.domain.comment.dto.response; + +import com.example.Veco.domain.external.dto.response.ExternalResponseDTO; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; +import java.util.List; + +public class CommentResponseDTO { + + @Getter + @AllArgsConstructor + @NoArgsConstructor + @Builder + public static class CommentListDTO { + private Integer cnt; + List info; + } + + @Getter + @AllArgsConstructor + @NoArgsConstructor + @Builder + public static class CommentInfoDTO { + private Long id; + private String profileUrl; + private String name; + private LocalDateTime createdAt; + private String content; + } +} diff --git a/src/main/java/com/example/Veco/domain/comment/service/CommentService.java b/src/main/java/com/example/Veco/domain/comment/service/CommentService.java index a25f7160..096c9711 100644 --- a/src/main/java/com/example/Veco/domain/comment/service/CommentService.java +++ b/src/main/java/com/example/Veco/domain/comment/service/CommentService.java @@ -2,11 +2,12 @@ import com.example.Veco.domain.comment.dto.request.CommentCreateDTO; import com.example.Veco.domain.comment.dto.response.CommentListResponseDTO; +import com.example.Veco.domain.comment.dto.response.CommentResponseDTO; import com.example.Veco.global.enums.Category; import java.util.List; public interface CommentService { Long addComment(CommentCreateDTO commentCreateDTO); - CommentListResponseDTO getComments(Long targetId, Category category); + CommentResponseDTO.CommentListDTO getComments(Long targetId, Category category); } diff --git a/src/main/java/com/example/Veco/domain/comment/service/CommentServiceImpl.java b/src/main/java/com/example/Veco/domain/comment/service/CommentServiceImpl.java index 88a6c667..1d497998 100644 --- a/src/main/java/com/example/Veco/domain/comment/service/CommentServiceImpl.java +++ b/src/main/java/com/example/Veco/domain/comment/service/CommentServiceImpl.java @@ -4,6 +4,7 @@ import com.example.Veco.domain.comment.converter.CommentRoomConverter; import com.example.Veco.domain.comment.dto.request.CommentCreateDTO; import com.example.Veco.domain.comment.dto.response.CommentListResponseDTO; +import com.example.Veco.domain.comment.dto.response.CommentResponseDTO; import com.example.Veco.domain.comment.entity.Comment; import com.example.Veco.domain.comment.entity.CommentRoom; import com.example.Veco.domain.comment.repository.CommentRepository; @@ -58,19 +59,19 @@ public Long addComment(CommentCreateDTO commentCreateDTO) { } @Transactional(readOnly = true) - public CommentListResponseDTO getComments(Long targetId, Category category) { + public CommentResponseDTO.CommentListDTO getComments(Long targetId, Category category) { // 리소스 존재 여부 검증 validateResourceExists(targetId, category); CommentRoom commentRoom = commentRoomRepository.findByRoomTypeAndTargetId(category, targetId); if (commentRoom == null) { - return CommentConverter.toCommentResponseDTO(new ArrayList<>()); // 댓글방이 없으면 빈 리스트 반환 + return CommentConverter.toCommentListDTO(new ArrayList<>()); // 댓글방이 없으면 빈 리스트 반환 } - List comments = commentRepository.findAllByCommentRoomOrderByIdDesc(commentRoom); + List comments = commentRepository.findAllByCommentRoomOrderByIdAsc(commentRoom); - return CommentConverter.toCommentResponseDTO(comments); + return CommentConverter.toCommentListDTO(comments); } private CommentRoom findOrCreateCommentRoom(Long resourceId, Category resourceType) { diff --git a/src/main/java/com/example/Veco/domain/external/entity/External.java b/src/main/java/com/example/Veco/domain/external/entity/External.java index 89c5d934..f9dec9c0 100644 --- a/src/main/java/com/example/Veco/domain/external/entity/External.java +++ b/src/main/java/com/example/Veco/domain/external/entity/External.java @@ -83,7 +83,7 @@ public class External extends BaseEntity { @JoinColumn(name = "goal_id") private Goal goal; - @OneToMany(mappedBy = "external", cascade = CascadeType.PERSIST) + @OneToMany(mappedBy = "external", cascade = CascadeType.ALL) @Builder.Default private List assignments = new ArrayList<>(); diff --git a/src/main/java/com/example/Veco/domain/issue/service/command/IssueCommandServiceImpl.java b/src/main/java/com/example/Veco/domain/issue/service/command/IssueCommandServiceImpl.java index d038caca..6b49d496 100644 --- a/src/main/java/com/example/Veco/domain/issue/service/command/IssueCommandServiceImpl.java +++ b/src/main/java/com/example/Veco/domain/issue/service/command/IssueCommandServiceImpl.java @@ -1,8 +1,6 @@ package com.example.Veco.domain.issue.service.command; import com.example.Veco.domain.goal.entity.Goal; -import com.example.Veco.domain.goal.exception.GoalException; -import com.example.Veco.domain.goal.exception.code.GoalErrorCode; import com.example.Veco.domain.goal.repository.GoalRepository; import com.example.Veco.domain.issue.converter.IssueConverter; import com.example.Veco.domain.issue.dto.IssueReqDTO; @@ -128,8 +126,10 @@ public IssueResponseDTO.CreateIssue createIssue(AuthUser user, Long teamId, Issu .orElseThrow(() -> new MemberHandler(MemberErrorStatus._FORBIDDEN)); // 목표 존재 검증 - Goal goal = goalRepository.findById(dto.goalId()).orElseThrow(()-> - new GoalException(GoalErrorCode.NOT_FOUND)); + Goal goal = null; + if (dto.goalId() != null) { + goal = goalRepository.findById(dto.goalId()).orElse(null); + } RLock lock = redissonClient.getLock("lock:issue:" + teamId); Long issueId; diff --git a/src/main/java/com/example/Veco/global/healthcheck/HealthCheckController.java b/src/main/java/com/example/Veco/global/healthcheck/HealthCheckController.java index 7c892552..86796418 100644 --- a/src/main/java/com/example/Veco/global/healthcheck/HealthCheckController.java +++ b/src/main/java/com/example/Veco/global/healthcheck/HealthCheckController.java @@ -1,5 +1,6 @@ package com.example.Veco.global.healthcheck; +import io.swagger.v3.oas.annotations.Hidden; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -7,6 +8,7 @@ public class HealthCheckController { @GetMapping("/healthcheck") + @Hidden public String healthcheck() { return "OK"; } diff --git a/src/main/java/com/example/Veco/test/TestDataController.java b/src/main/java/com/example/Veco/test/TestDataController.java index 23a388e0..1369851a 100644 --- a/src/main/java/com/example/Veco/test/TestDataController.java +++ b/src/main/java/com/example/Veco/test/TestDataController.java @@ -12,14 +12,17 @@ import com.example.Veco.domain.member.repository.MemberRepository; import com.example.Veco.domain.team.entity.Team; import com.example.Veco.domain.team.repository.TeamRepository; -import com.example.Veco.global.enums.*; +import com.example.Veco.global.enums.Category; +import com.example.Veco.global.enums.ExtServiceType; +import com.example.Veco.global.enums.Priority; +import com.example.Veco.global.enums.State; +import io.swagger.v3.oas.annotations.Hidden; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -43,6 +46,7 @@ public class TestDataController { private AssigmentRepository assignmentRepository; @PostMapping("/insert-test-data") + @Hidden public String insertTestData() { try { // 1. Member 테스트 데이터