Skip to content

Commit 0dbe896

Browse files
committed
♻️ [Refactor] Node 구조 변경 및 Repository 메소드명 변경
1 parent 736d7e9 commit 0dbe896

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

src/main/java/com/going/server/domain/cluster/entity/Cluster.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
public class Cluster {
1717
@Id
1818
@GeneratedValue
19+
private Long id;
20+
21+
@Property("cluster_id")
1922
private Long clusterId;
2023

2124
@Property("represent_word")

src/main/java/com/going/server/domain/cluster/repository/ClusterRepository.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
import org.springframework.data.neo4j.repository.Neo4jRepository;
66
import org.springframework.stereotype.Repository;
77

8+
import java.util.Optional;
9+
810
@Repository
911
public interface ClusterRepository extends Neo4jRepository<Cluster, Long> {
1012
Cluster findByRepresentWord(String word);
1113

14+
Optional<Cluster> findByClusterId(Long clusterId);
15+
1216
default Cluster getByCluster(Long clusterId) {
13-
return findById(clusterId).orElseThrow(ClusterNotFoundException::new);
17+
return findByClusterId(clusterId).orElseThrow(ClusterNotFoundException::new);
1418
}
1519
}

src/main/java/com/going/server/domain/sentence/entity/Sentence.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public class Sentence {
1414

1515
@Id
1616
@GeneratedValue
17+
private Long id;
18+
19+
@Property("sentence_id")
1720
private Long sentenceId;
1821

1922
@Property("sentence")

src/main/java/com/going/server/domain/word/entity/Word.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public class Word {
1414

1515
@Id
1616
@GeneratedValue
17+
private Long id;
18+
19+
@Property("word_id")
1720
private Long wordId;
1821

1922
@Property("compose_word")

src/main/java/com/going/server/domain/word/repository/WordRepository.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
import org.springframework.stereotype.Repository;
77

88
import java.util.List;
9+
import java.util.Optional;
910

1011
@Repository
1112
public interface WordRepository extends Neo4jRepository<Word, Long> {
13+
Optional<Word> findByWordId(Long wordId);
14+
1215
List<Word> findByCluster_ClusterId(Long clusterId);
1316

1417
default Word getByWord(Long wordId) {
15-
return findById(wordId).orElseThrow(WordNotFoundException::new);
18+
return findByWordId(wordId).orElseThrow(WordNotFoundException::new);
1619
}
1720
}

0 commit comments

Comments
 (0)