Commit 84e1ca6e authored by shj's avatar shj

[ADD] 다음 가이드, 이전 가이드 할당 함수 개편

- 개편된 Guide Model 적용
- depth와 order를 활용하여 find
- 미사용 코드 삭제
parent 1ae93788
...@@ -6,6 +6,7 @@ import lombok.Data; ...@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import nonapi.io.github.classgraph.json.Id; import nonapi.io.github.classgraph.json.Id;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import java.io.Serializable; import java.io.Serializable;
...@@ -24,13 +25,14 @@ public class GuideTest implements Serializable { ...@@ -24,13 +25,14 @@ public class GuideTest implements Serializable {
private String title; private String title;
private Integer order; private Integer order;
private String path; private String path;
private Integer depth;
private Integer view; private Integer view;
private Integer like; private Integer like;
// @Transient @Transient
// private Guide prevContent; private GuideTest prevGuide;
// @Transient @Transient
// private Guide nextContent; private GuideTest nextGuide;
private LocalDateTime createDate; private LocalDateTime createDate;
@LastModifiedDate @LastModifiedDate
......
...@@ -10,10 +10,10 @@ import java.util.List; ...@@ -10,10 +10,10 @@ import java.util.List;
@Repository @Repository
public interface GuideTestRepository extends CrudRepository<GuideTest, String> { public interface GuideTestRepository extends CrudRepository<GuideTest, String> {
List<GuideTest> findAll();
List<GuideTest> findAllByOrderByOrder(); List<GuideTest> findAllByOrderByOrder();
// List<GuideTest> findAllByParentIdOrderByOrderAsc(String parentId); List<GuideTest> findAllByPathContainingAndDepth(String path, Integer depth);
// List<GuideTest> findAllByKeywordSetContaining(String keyword); List<GuideTest> findAllByPathContainingAndDepthOrderByOrderDesc(String path, Integer depth);
int countAllBy(); GuideTest findByPath(String path);
// int countAllByParentId(String parentId); GuideTest findByPathContainingAndDepthAndOrder(String path, Integer depth, Integer order);
} }
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<v-divider class="my-8"/> <v-divider class="my-8"/>
<v-row no-gutters align="center"> <v-row no-gutters align="center">
<v-btn class="primary--text" :ripple="false" height="64" text outlined @click="openGuide(guide.prevContent)" v-if="guide !== null && guide.prevContent"> <v-btn class="primary--text" :ripple="false" height="64" text outlined @click="openGuide(guide.prevGuide)" v-if="guide !== null && guide.prevGuide">
<v-row no-gutters align="center"> <v-row no-gutters align="center">
<v-col class="mr-8"> <v-col class="mr-8">
<v-icon left>mdi-chevron-left</v-icon> <v-icon left>mdi-chevron-left</v-icon>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<v-col align="end" justify="end"> <v-col align="end" justify="end">
<span class="grey--text">이전 페이지</span> <br/> <span class="grey--text">이전 페이지</span> <br/>
<span style="font-size:1.1rem;font-weight:bold;"> <span style="font-size:1.1rem;font-weight:bold;">
{{parsingContentTitle(guide.prevContent)}} {{guide.prevGuide.title}}
</span> </span>
</v-col> </v-col>
...@@ -107,13 +107,13 @@ ...@@ -107,13 +107,13 @@
<v-spacer/> <v-spacer/>
<v-btn class="primary--text" :ripple="false" height="64" text outlined @click="openGuide(guide.nextContent)" v-if="guide !== null && guide.nextContent"> <v-btn class="primary--text" :ripple="false" height="64" text outlined @click="openGuide(guide.nextGuide)" v-if="guide !== null && guide.nextGuide">
<v-row no-gutters align="center"> <v-row no-gutters align="center">
<v-col align="start" justify="start"> <v-col align="start" justify="start">
<span class="grey--text">다음 페이지</span> <br/> <span class="grey--text">다음 페이지</span> <br/>
<span style="font-size:1.1rem;font-weight:bold;"> <span style="font-size:1.1rem;font-weight:bold;">
{{ parsingContentTitle(guide.nextContent)}} {{ guide.nextGuide.title}}
</span> </span>
</v-col> </v-col>
<v-col class="ml-8"> <v-col class="ml-8">
...@@ -157,7 +157,7 @@ export default { ...@@ -157,7 +157,7 @@ export default {
await this.getGuideContents() await this.getGuideContents()
this.loading = false this.loading = false
// this.generateNavitator() this.generateNavigator()
}, },
async getGuideContents() { async getGuideContents() {
...@@ -272,9 +272,7 @@ export default { ...@@ -272,9 +272,7 @@ export default {
}, },
openGuide(guide) { openGuide(guide) {
this.$router.push('/' + this.parsingContentTitle(guide)) this.$router.push('/' + guide.id)
this.$store.commit('setGuide', {guideId:guide.id, flag:true})
this.$store.state.guideId = guide.id
}, },
openGithub(contentKey) { openGithub(contentKey) {
...@@ -286,7 +284,7 @@ export default { ...@@ -286,7 +284,7 @@ export default {
return false return false
}, },
async generateNavitator() { async generateNavigator() {
this.loading = true this.loading = true
let newNavigator = [] let newNavigator = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment