Skip to content

Commit f8fea63

Browse files
authored
Merge pull request #110 from prgrms-web-devcourse-final-project/node/11
[REFACTOR]: 브랜치동기화 기능 메인 -> 분기를 했던 최신 가지 기준으로 변경
2 parents a7778a5 + 7402f53 commit f8fea63

File tree

13 files changed

+360
-65
lines changed

13 files changed

+360
-65
lines changed

back/src/main/java/com/back/domain/node/controller/DecisionLineController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public class DecisionLineController {
2626

2727
private final NodeQueryService nodeQueryService;
2828

29-
// 가장 중요한: 인증 사용자별 결정 라인 목록(요약)
29+
// 인증 사용자별 결정 라인 목록(요약)
3030
@GetMapping
3131
public ResponseEntity<DecisionLineListDto> list(@AuthenticationPrincipal CustomUserDetails me) {
3232
if (me == null) throw new ApiException(ErrorCode.HANDLE_ACCESS_DENIED, "login required");
3333
return ResponseEntity.ok(nodeQueryService.getDecisionLines(me.getId()));
3434
}
3535

36-
// 가장 많이 사용하는: 특정 결정 라인 상세
36+
// 특정 결정 라인 상세
3737
@GetMapping("/{decisionLineId}")
3838
public ResponseEntity<DecisionLineDetailDto> detail(@PathVariable Long decisionLineId) {
3939
return ResponseEntity.ok(nodeQueryService.getDecisionLineDetail(decisionLineId));

back/src/main/java/com/back/domain/node/controller/DvcsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.springframework.web.bind.annotation.*;
1717

1818
import java.util.List;
19-
19+
// 이 컨트롤러는 현재 사용하지 않으며 향후 DVCS 를 이용한 라인, 노드 편집 기능이 추가될 때 활성화될 예정임
2020
@RestController
2121
@RequestMapping("/api/v1/dvcs")
2222
@RequiredArgsConstructor

back/src/main/java/com/back/domain/node/dto/decision/ForkFromDecisionRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public record ForkFromDecisionRequest(
1919
String situation, // 선택(교체)
2020
String description // 선택(교체)
2121
) {
22-
// 가장 많이 사용하는: 구버전 호환(keepUntilParent/lineTitle을 받던 생성 시그니처 흡수)
22+
// 구버전 호환(keepUntilParent/lineTitle을 받던 생성 시그니처 흡수)
2323
public ForkFromDecisionRequest(Long userId,
2424
Long parentDecisionNodeId,
2525
Integer targetOptionIndex,

back/src/main/java/com/back/domain/node/entity/BaseNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public class BaseNode extends BaseEntity {
6666
@Column(columnDefinition = "TEXT")
6767
private String description;
6868

69-
// ▼ 추가: 현재 적용 버전(Resolver가 우선 사용)
7069
@ManyToOne(fetch = FetchType.LAZY)
7170
@JoinColumn(name = "current_version_id")
7271
private NodeAtomVersion currentVersion;

back/src/main/java/com/back/domain/node/entity/DecisionNode.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public class DecisionNode extends BaseEntity {
7272
@Column(columnDefinition = "TEXT")
7373
private String description;
7474

75-
// ▼ 추가: 해석 정책/버전
7675
@Enumerated(EnumType.STRING)
7776
@Column(nullable = false)
7877
@Builder.Default

back/src/main/java/com/back/domain/node/service/BaseLineService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BaseLineService {
5656

5757
private final NodeMappers mappers;
5858

59-
// 가장 중요한: 라인 생성 + 루트 커밋 + 초기 패치
59+
// 라인 생성 + 루트 커밋 + 초기 패치
6060
@Transactional
6161
public BaseLineBulkCreateResponse createBaseLineWithNodes(BaseLineBulkCreateRequest request) {
6262

@@ -115,7 +115,7 @@ public BaseLineBulkCreateResponse createBaseLineWithNodes(BaseLineBulkCreateRequ
115115
main.moveHeadTo(root);
116116
branchRepo.save(main);
117117

118-
// 가장 많이 사용하는: 생성된 노드들에 대한 초기 패치 저장
118+
// 생성된 노드들에 대한 초기 패치 저장
119119
for (BaseNode bn : createdEntities) {
120120
NodeAtomVersion v = bn.getCurrentVersion();
121121
if (v == null) continue;
@@ -147,15 +147,15 @@ public PivotListDto getPivotBaseNodes(Long baseLineId) {
147147

148148
@Transactional
149149
public void deleteBaseLineDeep(Long userId, Long baseLineId) {
150-
// 가장 많이 사용하는 호출: 소유자/존재 여부 검증
150+
// 소유자/존재 여부 검증
151151
boolean owned = baseLineRepository.existsByIdAndUser_Id(baseLineId, userId);
152152
if (!owned) throw new ApiException(ErrorCode.BASE_LINE_NOT_FOUND, "baseline not found or not owned");
153153

154-
// 가장 많이 사용하는 호출: 결정노드 → 결정라인
154+
// 결정노드 → 결정라인
155155
decisionNodeRepository.deleteByDecisionLine_BaseLine_Id(baseLineId);
156156
decisionLineRepository.deleteByBaseLine_Id(baseLineId);
157157

158-
// 가장 많이 사용하는 호출: DVCS 역순(Patch→Commit→Branch)
158+
// DVCS 역순(Patch→Commit→Branch)
159159
patchRepo.deleteByCommit_Branch_BaseLine_Id(baseLineId);
160160
branchRepo.clearHeadByBaseLineId(baseLineId);
161161
commitRepo.deleteByBranch_BaseLine_Id(baseLineId);
@@ -184,7 +184,7 @@ public void deleteBaseLineDeep(Long userId, Long baseLineId) {
184184
em.flush();
185185
em.clear();
186186

187-
// 가장 많이 사용하는 호출: 베이스노드 베이스라인
187+
// 베이스노드 -> 베이스라인
188188
baseNodeRepository.deleteByBaseLine_Id(baseLineId);
189189
baseLineRepository.deleteByIdAndUser_Id(baseLineId, userId);
190190
}

0 commit comments

Comments
 (0)