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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ VECO는 **AI를 활용해 분산된 정보를 한곳에 모으고, 목표를 명
- 마크/김주헌: 목표, Slack 연동
---
## 🛜 서버 현황
<img width="776" height="567" alt="스크린샷 2025-08-09 04 46 30" src="https://github.com/user-attachments/assets/f109d3c6-85dd-4725-9ae0-59a8ef432026" />
<img width="776" height="567" alt="476164894-f109d3c6-85dd-4725-9ae0-59a8ef432026" src="https://github.com/user-attachments/assets/aa079cd7-2711-4502-9db8-69738e3ae9c0" />

- main-develop 브랜치 구조에 따라 배포환경, 개발환경을 따로 구성
- 개발 환경(localhost:5173)과 배포 환경(web.vecoservice.shop)간 테스트를 진행
- 추후, 서버를 통합 관리해 무중단 배포 전략(블루-그린) 사용

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,7 +73,7 @@ public ApiResponse<Long> createComment(
)
})
@GetMapping
public ApiResponse<CommentListResponseDTO> getAllComments(
public ApiResponse<CommentResponseDTO.CommentListDTO> getAllComments(
@Parameter(description = "댓글을 조회할 대상 리소스의 ID", required = true, example = "1")
@RequestParam("targetId") Long targetId,
@Parameter(description = "리소스 카테고리 (ISSUE, GOAL, EXTERNAL)", required = true, example = "ISSUE")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,30 +23,26 @@ public static Comment toComment(CommentCreateDTO commentCreateDTO, CommentRoom c
return comment;
}

public static CommentListResponseDTO toCommentResponseDTO(List<Comment> comments) {
public static CommentResponseDTO.CommentListDTO toCommentListDTO(List<Comment> comments) {

List<CommentListResponseDTO.CommentResponseDTO> commentResponseDTOS = new ArrayList<>();
List<CommentResponseDTO.CommentInfoDTO> 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();
}
}
Original file line number Diff line number Diff line change
@@ -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<CommentResponseDTO.CommentInfoDTO> info;
}

@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public static class CommentInfoDTO {
private Long id;
private String profileUrl;
private String name;
private LocalDateTime createdAt;
private String content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Comment> comments = commentRepository.findAllByCommentRoomOrderByIdDesc(commentRoom);
List<Comment> comments = commentRepository.findAllByCommentRoomOrderByIdAsc(commentRoom);

return CommentConverter.toCommentResponseDTO(comments);
return CommentConverter.toCommentListDTO(comments);
}

private CommentRoom findOrCreateCommentRoom(Long resourceId, Category resourceType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Assignment> assignments = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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;

@RestController
public class HealthCheckController {

@GetMapping("/healthcheck")
@Hidden
public String healthcheck() {
return "OK";
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/example/Veco/test/TestDataController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -43,6 +46,7 @@ public class TestDataController {
private AssigmentRepository assignmentRepository;

@PostMapping("/insert-test-data")
@Hidden
public String insertTestData() {
try {
// 1. Member 테스트 데이터
Expand Down