From 96444de64e49be97a83cf8aac63945ffdc7f3f8e Mon Sep 17 00:00:00 2001 From: EpicFn Date: Thu, 2 Oct 2025 12:14:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix=20:=20node,=20edge=20dto=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dashboard/dto/BodyForReactFlow.java | 103 ++++++++++++------ .../backend/domain/dashboard/entity/Edge.java | 13 --- .../backend/domain/dashboard/entity/Node.java | 12 ++ 3 files changed, 83 insertions(+), 45 deletions(-) diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java index 037b8882..5627a5f8 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java @@ -19,27 +19,42 @@ public record BodyForReactFlow( public record NodeDto( @JsonProperty("id") String nodeKey, @JsonProperty("type") String nodeType, - Map data, - @JsonProperty("position") PositionDto positionDto + @JsonProperty("selected") Boolean selected, + @JsonProperty("dragging") Boolean dragging, + @JsonProperty("position") PositionDto positionDto, + @JsonProperty("measured") MeasurementsDto measurements, + @JsonProperty("data") DataDto data ) { public record PositionDto( @JsonProperty("x") double x, @JsonProperty("y") double y - ) {} + ) {} + + public record MeasurementsDto( + @JsonProperty("width") double width, + @JsonProperty("height") double height + ) {} + + public record DataDto( + @JsonProperty("content") String content, + @JsonProperty("createdAt") String createAt, // YYYY-MM-DD format + @JsonProperty("link") String sourceUrl, + @JsonProperty("title") String title, + @JsonProperty("user") WriterDto writer + ) {} + + public record WriterDto( + @JsonProperty("name") String name, + @JsonProperty("profileUrl") String profileImageUrl + ) {} + } public record EdgeDto( @JsonProperty("id") String edgeKey, @JsonProperty("source") String sourceNodeKey, - @JsonProperty("target") String targetNodeKey, - @JsonProperty("type") String edgeType, - @JsonProperty("animated") boolean isAnimated, - @JsonProperty("style") StyleDto styleDto + @JsonProperty("target") String targetNodeKey ) { - public record StyleDto( - String stroke, - Double strokeWidth - ) {} } // DTO -> Entity, BodyForReactFlow를 Graph 엔티티로 변환 @@ -51,10 +66,24 @@ public Graph toEntity() { Node node = new Node(); node.setNodeKey(dto.nodeKey()); node.setNodeType(NodeType.valueOf(dto.nodeType().toUpperCase())); - node.setData(dto.data()); + node.setSelected(dto.selected() != null ? dto.selected() : false); + node.setDragging(dto.dragging() != null ? dto.dragging() : false); node.setPositonX(dto.positionDto().x()); node.setPositonY(dto.positionDto().y()); - node.setGraph(graph); // 연관관계 설정 + if (dto.measurements() != null) { + node.setWidth(dto.measurements().width()); + node.setHeight(dto.measurements().height()); + } + if (dto.data() != null) { + node.setData(Map.of( + "content", dto.data().content(), + "createdAt", dto.data().createAt(), + "sourceUrl", dto.data().sourceUrl(), + "title", dto.data().title(), + "writerName", dto.data().writer() != null ? dto.data().writer().name() : null, + "writerProfileImageUrl", dto.data().writer() != null ? dto.data().writer().profileImageUrl() : null + )); + } return node; }) .toList(); @@ -65,12 +94,6 @@ public Graph toEntity() { edge.setEdgeKey(dto.edgeKey()); edge.setSourceNodeKey(dto.sourceNodeKey()); edge.setTargetNodeKey(dto.targetNodeKey()); - edge.setEdgeType(EdgeType.valueOf(dto.edgeType().toUpperCase())); - edge.setAnimated(dto.isAnimated()); - if (dto.styleDto() != null) { - edge.setStroke(dto.styleDto().stroke()); - edge.setStrokeWidth(dto.styleDto().strokeWidth()); - } edge.setGraph(graph); // 연관관계 설정 return edge; }) @@ -88,8 +111,20 @@ public static BodyForReactFlow from(Graph graph) { .map(n -> new NodeDto( n.getNodeKey(), n.getNodeType().name().toUpperCase(), - n.getData(), - new NodeDto.PositionDto(n.getPositonX(), n.getPositonY()) + n.isSelected(), + n.isDragging(), + new NodeDto.PositionDto(n.getPositonX(), n.getPositonY()), + new NodeDto.MeasurementsDto(n.getWidth(), n.getHeight()), + new NodeDto.DataDto( + n.getData().get("content"), + n.getData().get("createdAt"), + n.getData().get("sourceUrl"), + n.getData().get("title"), + new NodeDto.WriterDto( + n.getData().get("writerName"), + n.getData().get("writerProfileImageUrl") + ) + ) )) .toList(); @@ -97,10 +132,7 @@ public static BodyForReactFlow from(Graph graph) { .map(e -> new EdgeDto( e.getEdgeKey(), e.getSourceNodeKey(), - e.getTargetNodeKey(), - e.getEdgeType().name().toUpperCase(), - e.isAnimated(), - new EdgeDto.StyleDto(e.getStroke(), e.getStrokeWidth()) + e.getTargetNodeKey() )) .toList(); @@ -113,9 +145,22 @@ public List toNodeEntities(Graph graph) { Node node = new Node(); node.setNodeKey(dto.nodeKey()); node.setNodeType(NodeType.valueOf(dto.nodeType().toUpperCase())); - node.setData(dto.data()); node.setPositonX(dto.positionDto().x()); node.setPositonY(dto.positionDto().y()); + if (dto.measurements() != null) { + node.setWidth(dto.measurements().width()); + node.setHeight(dto.measurements().height()); + } + if (dto.data() != null) { + node.setData(Map.of( + "content", dto.data().content(), + "createdAt", dto.data().createAt(), + "sourceUrl", dto.data().sourceUrl(), + "title", dto.data().title(), + "writerName", dto.data().writer() != null ? dto.data().writer().name() : null, + "writerProfileImageUrl", dto.data().writer() != null ? dto.data().writer().profileImageUrl() : null + )); + } node.setGraph(graph); // 연관관계 설정 return node; }) @@ -129,12 +174,6 @@ public List toEdgeEntities(Graph graph) { edge.setEdgeKey(dto.edgeKey()); edge.setSourceNodeKey(dto.sourceNodeKey()); edge.setTargetNodeKey(dto.targetNodeKey()); - edge.setEdgeType(EdgeType.valueOf(dto.edgeType().toUpperCase())); - edge.setAnimated(dto.isAnimated()); - if (dto.styleDto() != null) { - edge.setStroke(dto.styleDto().stroke()); - edge.setStrokeWidth(dto.styleDto().strokeWidth()); - } edge.setGraph(graph); // 연관관계 설정 return edge; }) diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Edge.java b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Edge.java index 65538cc1..91126fbb 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Edge.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Edge.java @@ -22,17 +22,4 @@ public class Edge extends BaseEntity { @Column private String targetNodeKey; - - @Column - @Enumerated(EnumType.STRING) - private EdgeType edgeType; - - @Column - boolean isAnimated; - - @Column - private String stroke; - - @Column - private Double strokeWidth; } diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java index 64a3b3a8..9fb2bf9c 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java @@ -24,6 +24,12 @@ public class Node extends BaseEntity { @Enumerated(EnumType.STRING) private NodeType nodeType; + @Column + private boolean selected; + + @Column + private boolean dragging; + @ElementCollection @CollectionTable(name = "node_data", joinColumns = @JoinColumn(name = "node_id")) @MapKeyColumn(name = "data_key") @@ -35,4 +41,10 @@ public class Node extends BaseEntity { @Column private double positonY; + + @Column + private double width; + + @Column + private double height; } From 30fb59c41c767efb1c9dd455b02e878dc6359310 Mon Sep 17 00:00:00 2001 From: EpicFn Date: Thu, 2 Oct 2025 12:28:24 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BC=80=EC=9D=B4=EC=8A=A4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DashboardControllerTest.java | 113 ++++++++++++----- .../GraphUpdateConsumerTest.java | 114 +++++++++++++----- 2 files changed, 172 insertions(+), 55 deletions(-) diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java index 2e51822a..1130e291 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java @@ -13,7 +13,9 @@ import org.springframework.test.web.servlet.ResultActions; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionTemplate; +import org.tuna.zoopzoop.backend.domain.dashboard.entity.Edge; import org.tuna.zoopzoop.backend.domain.dashboard.entity.Graph; +import org.tuna.zoopzoop.backend.domain.dashboard.entity.Node; import org.tuna.zoopzoop.backend.domain.member.enums.Provider; import org.tuna.zoopzoop.backend.domain.member.repository.MemberRepository; import org.tuna.zoopzoop.backend.domain.member.service.MemberService; @@ -30,6 +32,7 @@ import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.Map; import java.util.concurrent.TimeUnit; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; @@ -183,9 +186,32 @@ void updateGraph_Success() throws Exception { transactionTemplate.execute(status -> { Space space = spaceService.findByName(authorizedSpaceName); Graph updatedGraph = space.getDashboard().getGraph(); + + // 1. 노드와 엣지의 전체 개수 검증 assertThat(updatedGraph.getNodes()).hasSize(2); assertThat(updatedGraph.getEdges()).hasSize(1); - assertThat(updatedGraph.getNodes().get(0).getData().get("title")).isEqualTo("노드1"); + + // 2. 특정 노드(id="1")의 상세 데이터 검증 + // DTO의 List 순서대로 엔티티가 생성되므로 get(0)으로 첫 번째 노드를 특정합니다. + Node firstNode = updatedGraph.getNodes().get(0); + assertThat(firstNode.getNodeKey()).isEqualTo("1"); + assertThat(firstNode.getPositonX()).isEqualTo(100.0); + assertThat(firstNode.getPositonY()).isEqualTo(200.0); + + // Node의 data Map 내부 값들을 상세히 검증 + Map data = firstNode.getData(); + assertThat(data.get("title")).isEqualTo("노드 1"); + assertThat(data.get("content")).isEqualTo("첫 번째 노드에 대한 간단한 요약 내용입니다. 이 내용은 노드 내부에 표시됩니다."); + assertThat(data.get("sourceUrl")).isEqualTo("https://example.com/source1"); + assertThat(data.get("writerName")).isEqualTo("김Tuna"); + assertThat(data.get("writerProfileImageUrl")).isEqualTo("https://example.com/profiles/tuna.jpg"); + + // 3. 엣지(id="e1-2")의 상세 데이터 검증 + Edge edge = updatedGraph.getEdges().get(0); + assertThat(edge.getEdgeKey()).isEqualTo("e1-2"); + assertThat(edge.getSourceNodeKey()).isEqualTo("1"); + assertThat(edge.getTargetNodeKey()).isEqualTo("2"); + return null; // execute 메서드는 반환값이 필요 }); }); @@ -235,32 +261,65 @@ void updateGraph_Fail_Forbidden() throws Exception { private String createReactFlowJsonBody() { return """ - { - "nodes": [ - { - "id": "1", - "type": "CUSTOM", - "data": { "title": "노드1", "description": "설명1" }, - "position": { "x": 100, "y": 200 } - }, - { - "id": "2", - "type": "CUSTOM", - "data": { "title": "노드2" }, - "position": { "x": 300, "y": 400 } - } - ], - "edges": [ - { - "id": "e1-2", - "source": "1", - "target": "2", - "type": "SMOOTHSTEP", - "animated": true, - "style": { "stroke": "#999", "strokeWidth": 2.0 } - } - ] - } + { + "nodes": [ + { + "id": "1", + "type": "CUSTOM", + "selected": false, + "dragging": false, + "position": { + "x": 100, + "y": 200 + }, + "measured": { + "width": 250, + "height": 150 + }, + "data": { + "content": "첫 번째 노드에 대한 간단한 요약 내용입니다. 이 내용은 노드 내부에 표시됩니다.", + "createdAt": "2025-10-02", + "link": "https://example.com/source1", + "title": "노드 1", + "user": { + "name": "김Tuna", + "profileUrl": "https://example.com/profiles/tuna.jpg" + } + } + }, + { + "id": "2", + "type": "CUSTOM", + "selected": false, + "dragging": false, + "position": { + "x": 500, + "y": 300 + }, + "measured": { + "width": 250, + "height": 150 + }, + "data": { + "content": "두 번째 노드에 대한 요약입니다. 원본 소스는 다른 곳을 가리킵니다.", + "createdAt": "2025-10-01", + "link": "https://example.com/source2", + "title": "노드 2", + "user": { + "name": "박Zoop", + "profileUrl": "https://example.com/profiles/zoop.jpg" + } + } + } + ], + "edges": [ + { + "id": "e1-2", + "source": "1", + "target": "2" + } + ] + } """; } diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java index 4774022c..a6692c7a 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java @@ -7,11 +7,14 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionTemplate; import org.tuna.zoopzoop.backend.domain.dashboard.dto.GraphUpdateMessage; +import org.tuna.zoopzoop.backend.domain.dashboard.entity.Edge; import org.tuna.zoopzoop.backend.domain.dashboard.entity.Graph; +import org.tuna.zoopzoop.backend.domain.dashboard.entity.Node; import org.tuna.zoopzoop.backend.domain.space.space.entity.Space; import org.tuna.zoopzoop.backend.domain.space.space.service.SpaceService; import org.tuna.zoopzoop.backend.testSupport.ControllerTestSupport; +import java.util.Map; import java.util.concurrent.TimeUnit; import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; @@ -35,7 +38,6 @@ void setUp(){ spaceService.createSpace(existingSpaceName, "thumb1"); } - @Test @DisplayName("큐에 업데이트 메시지가 들어오면 컨슈머가 DB를 성공적으로 업데이트한다") void handleGraphUpdate_Success() throws Exception { @@ -54,9 +56,32 @@ void handleGraphUpdate_Success() throws Exception { transactionTemplate.execute(status -> { Space space = spaceService.findByName(existingSpaceName); Graph updatedGraph = space.getDashboard().getGraph(); + + // 1. 노드와 엣지의 전체 개수 검증 assertThat(updatedGraph.getNodes()).hasSize(2); assertThat(updatedGraph.getEdges()).hasSize(1); - assertThat(updatedGraph.getNodes().get(0).getData().get("title")).isEqualTo("노드1"); + + // 2. 특정 노드(id="1")의 상세 데이터 검증 + // DTO의 List 순서대로 엔티티가 생성되므로 get(0)으로 첫 번째 노드를 특정합니다. + Node firstNode = updatedGraph.getNodes().get(0); + assertThat(firstNode.getNodeKey()).isEqualTo("1"); + assertThat(firstNode.getPositonX()).isEqualTo(100.0); + assertThat(firstNode.getPositonY()).isEqualTo(200.0); + + // Node의 data Map 내부 값들을 상세히 검증 + Map data = firstNode.getData(); + assertThat(data.get("title")).isEqualTo("노드 1"); + assertThat(data.get("content")).isEqualTo("첫 번째 노드에 대한 간단한 요약 내용입니다. 이 내용은 노드 내부에 표시됩니다."); + assertThat(data.get("sourceUrl")).isEqualTo("https://example.com/source1"); + assertThat(data.get("writerName")).isEqualTo("김Tuna"); + assertThat(data.get("writerProfileImageUrl")).isEqualTo("https://example.com/profiles/tuna.jpg"); + + // 3. 엣지(id="e1-2")의 상세 데이터 검증 + Edge edge = updatedGraph.getEdges().get(0); + assertThat(edge.getEdgeKey()).isEqualTo("e1-2"); + assertThat(edge.getSourceNodeKey()).isEqualTo("1"); + assertThat(edge.getTargetNodeKey()).isEqualTo("2"); + return null; }); }); @@ -64,32 +89,65 @@ void handleGraphUpdate_Success() throws Exception { private String createReactFlowJsonBody() { return """ - { - "nodes": [ - { - "id": "1", - "type": "CUSTOM", - "data": { "title": "노드1", "description": "설명1" }, - "position": { "x": 100, "y": 200 } - }, - { - "id": "2", - "type": "CUSTOM", - "data": { "title": "노드2" }, - "position": { "x": 300, "y": 400 } - } - ], - "edges": [ - { - "id": "e1-2", - "source": "1", - "target": "2", - "type": "SMOOTHSTEP", - "animated": true, - "style": { "stroke": "#999", "strokeWidth": 2.0 } - } - ] - } + { + "nodes": [ + { + "id": "1", + "type": "CUSTOM", + "selected": false, + "dragging": false, + "position": { + "x": 100, + "y": 200 + }, + "measured": { + "width": 250, + "height": 150 + }, + "data": { + "content": "첫 번째 노드에 대한 간단한 요약 내용입니다. 이 내용은 노드 내부에 표시됩니다.", + "createdAt": "2025-10-02", + "link": "https://example.com/source1", + "title": "노드 1", + "user": { + "name": "김Tuna", + "profileUrl": "https://example.com/profiles/tuna.jpg" + } + } + }, + { + "id": "2", + "type": "CUSTOM", + "selected": false, + "dragging": false, + "position": { + "x": 500, + "y": 300 + }, + "measured": { + "width": 250, + "height": 150 + }, + "data": { + "content": "두 번째 노드에 대한 요약입니다. 원본 소스는 다른 곳을 가리킵니다.", + "createdAt": "2025-10-01", + "link": "https://example.com/source2", + "title": "노드 2", + "user": { + "name": "박Zoop", + "profileUrl": "https://example.com/profiles/zoop.jpg" + } + } + } + ], + "edges": [ + { + "id": "e1-2", + "source": "1", + "target": "2" + } + ] + } """; } From 7b18e8de3746f5ba7026dca1b00f52cbf0ebea2f Mon Sep 17 00:00:00 2001 From: EpicFn Date: Thu, 2 Oct 2025 12:46:26 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/dashboard/service/GraphServiceTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java index 7e9af41c..30092241 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java @@ -60,10 +60,6 @@ void saveGraphWithNodesAndEdges() { edge.setEdgeKey("e1-2"); edge.setSourceNodeKey("1"); edge.setTargetNodeKey("2"); - edge.setEdgeType(EdgeType.SMOOTHSTEP); - edge.setAnimated(true); - edge.setStroke("#999"); - edge.setStrokeWidth(2.0); edge.setGraph(graph); // graph와 연결 From ebdf3ec75fed4de5dec38854218abde72384b1d7 Mon Sep 17 00:00:00 2001 From: EpicFn Date: Thu, 2 Oct 2025 12:51:47 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix=20:=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/dashboard/dto/BodyForReactFlow.java | 10 +++++----- .../zoopzoop/backend/domain/dashboard/entity/Node.java | 4 ++-- .../dashboard/controller/DashboardControllerTest.java | 4 ++-- .../extraComponent/GraphUpdateConsumerTest.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java index 5627a5f8..fe682888 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/dto/BodyForReactFlow.java @@ -68,8 +68,8 @@ public Graph toEntity() { node.setNodeType(NodeType.valueOf(dto.nodeType().toUpperCase())); node.setSelected(dto.selected() != null ? dto.selected() : false); node.setDragging(dto.dragging() != null ? dto.dragging() : false); - node.setPositonX(dto.positionDto().x()); - node.setPositonY(dto.positionDto().y()); + node.setPositionX(dto.positionDto().x()); + node.setPositionY(dto.positionDto().y()); if (dto.measurements() != null) { node.setWidth(dto.measurements().width()); node.setHeight(dto.measurements().height()); @@ -113,7 +113,7 @@ public static BodyForReactFlow from(Graph graph) { n.getNodeType().name().toUpperCase(), n.isSelected(), n.isDragging(), - new NodeDto.PositionDto(n.getPositonX(), n.getPositonY()), + new NodeDto.PositionDto(n.getPositionX(), n.getPositionY()), new NodeDto.MeasurementsDto(n.getWidth(), n.getHeight()), new NodeDto.DataDto( n.getData().get("content"), @@ -145,8 +145,8 @@ public List toNodeEntities(Graph graph) { Node node = new Node(); node.setNodeKey(dto.nodeKey()); node.setNodeType(NodeType.valueOf(dto.nodeType().toUpperCase())); - node.setPositonX(dto.positionDto().x()); - node.setPositonY(dto.positionDto().y()); + node.setPositionX(dto.positionDto().x()); + node.setPositionY(dto.positionDto().y()); if (dto.measurements() != null) { node.setWidth(dto.measurements().width()); node.setHeight(dto.measurements().height()); diff --git a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java index 9fb2bf9c..00f3266d 100644 --- a/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java +++ b/src/main/java/org/tuna/zoopzoop/backend/domain/dashboard/entity/Node.java @@ -37,10 +37,10 @@ public class Node extends BaseEntity { private Map data = new HashMap<>(); @Column - private double positonX; + private double positionX; @Column - private double positonY; + private double positionY; @Column private double width; diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java index 1130e291..bc1aff58 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/controller/DashboardControllerTest.java @@ -195,8 +195,8 @@ void updateGraph_Success() throws Exception { // DTO의 List 순서대로 엔티티가 생성되므로 get(0)으로 첫 번째 노드를 특정합니다. Node firstNode = updatedGraph.getNodes().get(0); assertThat(firstNode.getNodeKey()).isEqualTo("1"); - assertThat(firstNode.getPositonX()).isEqualTo(100.0); - assertThat(firstNode.getPositonY()).isEqualTo(200.0); + assertThat(firstNode.getPositionX()).isEqualTo(100.0); + assertThat(firstNode.getPositionY()).isEqualTo(200.0); // Node의 data Map 내부 값들을 상세히 검증 Map data = firstNode.getData(); diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java index a6692c7a..d598ddd8 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/extraComponent/GraphUpdateConsumerTest.java @@ -65,8 +65,8 @@ void handleGraphUpdate_Success() throws Exception { // DTO의 List 순서대로 엔티티가 생성되므로 get(0)으로 첫 번째 노드를 특정합니다. Node firstNode = updatedGraph.getNodes().get(0); assertThat(firstNode.getNodeKey()).isEqualTo("1"); - assertThat(firstNode.getPositonX()).isEqualTo(100.0); - assertThat(firstNode.getPositonY()).isEqualTo(200.0); + assertThat(firstNode.getPositionX()).isEqualTo(100.0); + assertThat(firstNode.getPositionY()).isEqualTo(200.0); // Node의 data Map 내부 값들을 상세히 검증 Map data = firstNode.getData(); From ba50e2ef24e9b3ec3e5a6cf926c047bb8ad5cb15 Mon Sep 17 00:00:00 2001 From: EpicFn Date: Thu, 2 Oct 2025 13:22:14 +0900 Subject: [PATCH 5/5] =?UTF-8?q?fix=20:=20=EC=98=A4=ED=83=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EC=88=98=EC=A0=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/dashboard/service/GraphServiceTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java index 30092241..2e54c18c 100644 --- a/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java +++ b/src/test/java/org/tuna/zoopzoop/backend/domain/dashboard/service/GraphServiceTest.java @@ -44,15 +44,15 @@ void saveGraphWithNodesAndEdges() { node1.setNodeKey("1"); node1.setNodeType(NodeType.CUSTOM); node1.setData(Map.of("title", "노드 제목", "description", "노드 설명")); - node1.setPositonX(100); - node1.setPositonY(200); + node1.setPositionX(100); + node1.setPositionY(200); node1.setGraph(graph); // 연관관계 주인 설정 Node node2 = new Node(); node2.setNodeKey("2"); node2.setNodeType(NodeType.CUSTOM); - node2.setPositonX(300); - node2.setPositonY(400); + node2.setPositionX(300); + node2.setPositionY(400); node2.setGraph(graph); // Edge 생성