Skip to content

Commit

Permalink
docs: README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kworkbee committed Mar 8, 2020
1 parent 29eafaf commit fc681ac
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 71 deletions.
Binary file added Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<p align="center">
<img src="AjouNICE.png" width="100">
</p>

# 아주나이스 (AjouNICE)

차세대 학부 커뮤니티 서비스 프로젝트 (개발진행 중)

아주 구성원 간의 다채로운 이야기를 나누는 차세대 커뮤니티 서비스를 만듭니다.

서비스 기능 추가, 의견 있으신 분들의 많은 조언 부탁드립니다.

[서비스 관련 제안접수](mailto:[email protected])

![Tech Stack](./AjouNICE_stack_flow.png)

[팀 빤스런](http://bbansrun.github.io)

김호영 최성흠 장순호 전지원
<p align="center">
<img src="Logo.png">
</p>

---

## 아주대학교 학부 커뮤니티 서비스 프로젝트 **(개발진행 중)**

아주 구성원 간의 다채로운 이야기를 나누는 차세대 커뮤니티 서비스를 만듭니다.

서비스 기능 추가, 의견 있으신 분들의 많은 조언 부탁드립니다.

[서비스 관련 제안접수](mailto:[email protected]) [email protected]

![Tech Stack](./AjouNICE_stack_flow.png)

[팀 빤스런](http://bbansrun.github.io)

김호영 최성흠 장순호 전지원

10 changes: 7 additions & 3 deletions apollo-server/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,21 @@ module.exports = {
},
// Pagination
async paginatedPosts (root, { category_idx, limit, end_cursor, }, { db, }, info) {
return await db.Board.paginate({
const paginateOptions = {
limit,
desc: true,
where: { category_idx, },
after: end_cursor,
include: [
{ model: db.BoardCategory, as: 'category', },
{ model: db.User, as: 'user', },
{ model: db.BoardComment, as: 'comments', include: [{ model: db.User, as: 'commenter', }], }
],
});
};
if (parseInt(category_idx) !== 0) {
paginateOptions.where = { category_idx, };
}
console.log(paginateOptions);
return await db.Board.paginate(paginateOptions);
},
async paginatedGourmets (root, { category_idx, limit, end_cursor, }, { db, }, info) {
return await db.RestaurantBoard.paginate({
Expand Down
2 changes: 2 additions & 0 deletions client/src/assets/graphql/queries/posts/Categories.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Write your query or mutation here
query Categories($type: CategoryType!, $depth: Int!) {
categories(category_type: $type, depth: $depth) {
category_idx
category_nm
category_icon
title
Expand All @@ -9,6 +10,7 @@ query Categories($type: CategoryType!, $depth: Int!) {
private_yn
upt_dt
childCategories {
category_idx
category_nm
category_icon
title
Expand Down
105 changes: 56 additions & 49 deletions client/src/views/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,44 @@
<Navigation :scroll-base="scrollBase" />
<Landing
ref="scrollBase"
:title="boardTitle"
:description="boardDescription"
:title="title"
:description="desc"
background="http://www.ajou.ac.kr/_attach/new/_images/2019/12/23/191223_main_visual05_bg.gif"
/>
<BoardNav :write-url="write_url" />
<nav class="category">
<ul class="category-menu">
<li class="active">
<router-link to="/board">
<router-link :to="`/board`">
전체
</router-link>
</li>
<li
v-for="category in navCategories"
:key="category.category_idx"
>
<router-link :to="`/board/${category.title}`">
<router-link :to="$route.params.category ? `/board/${$route.params.category}/${category.title}` : `/board/${category.title}`">
{{ category.category_nm }}
</router-link>
</li>
</ul>
</nav>
<div class="container">
<PostList :items="posts" />
<!-- <infinite-loading
<infinite-loading
ref="infinitePostLoader"
spinner="waveDots"
@infinite="infiniteHandler"
@infinite="loadPosts"
>
<div slot="no-more">
<font-awesome-icon icon="times" />&nbsp;
<span>더 이상 게시물이 없어요.</span>
</div>
<div slot="no-results">
찾으시는 게시물이 없어요.
<font-awesome-icon icon="times" />&nbsp;
<span>찾으시는 게시물이 없어요.</span>
</div>
</infinite-loading> -->
</infinite-loading>
</div>
<Footer />
</div>
Expand All @@ -49,7 +51,7 @@ import _ from 'lodash'
import gql from 'graphql-tag'
import urljoin from 'url-join'
import { Landing, Navigation, PostList, BoardNav, Footer } from '@/components'
import { Categories, AllCates, CateInfo, PostsByCate, SubCates, PaginationPosts } from '@/assets/graphql/queries'
import { Categories, PaginationPosts } from '@/assets/graphql/queries'
export default {
components: {
Landing,
Expand All @@ -64,7 +66,10 @@ export default {
write_url: urljoin(this.$route.path, '/new'),
posts: [],
navCategories: [],
cursor: ''
cursor: '',
cateIdx: null,
title: '게시판',
desc: '아주나이스 커뮤니티'
}
},
apollo: {
Expand All @@ -77,69 +82,71 @@ export default {
}
},
computed: {
boardTitle () {
if (!this.$route.params.category) {
return '게시판'
} else {
categoryLink (moduleName) {
let url
if (this.$route.params.category) {
if (!this.$route.params.name) {
return this.category
} else {
return this.sub_category
url = `/board/${this.$route.params.category}/${moduleName}`
}
}
},
boardDescription () {
if (!this.$route.params.name) {
return this.category_desc
} else {
return this.sub_category_desc
}
return url
}
},
watch: {
categories (value) {
if (value) {
this.initCategory()
}
},
'$route' (value) {
this.$router.go(0)
}
},
mounted () {
this.scrollBase = this.$refs.scrollBase.$el.getBoundingClientRect().bottom / 3
},
updated () {
this.initCategory()
},
methods: {
initCategory () {
if (this.$route.params.category) {
// 특정 Depth 카테고리 내 전체 게시물 조회
const cateIdx = _.findIndex(this.categories, (category) => (category.title === this.$route.params.category))
this.navCategories = this.categories[cateIdx].childCategories
const idx = _.findIndex(this.categories, (category) => (category.title === this.$route.params.category))
if (this.$route.params.name) {
// 특정 Depth 하위 카테고리 내 전체 게시물 조회
// Depth 1 카테고리 조회
const depth1Idx = _.findIndex(this.categories[idx].childCategories, (category) => (category.title === this.$route.params.name))
const depth1Category = this.categories[idx].childCategories[depth1Idx]
this.title = depth1Category.category_nm
this.desc = depth1Category.desc
this.cateIdx = depth1Category.category_idx
this.navCategories = []
} else {
// Depth 0 카테고리 조회
const depth0Category = this.categories[idx]
this.title = depth0Category.category_nm
this.desc = depth0Category.desc
this.cateIdx = depth0Category.category_idx
this.navCategories = depth0Category.childCategories
}
} else {
this.navCategories = this.categories
}
},
loadPosts ($state) {
this.$apollo.query({
query: gql`${PaginationPosts}`,
variables: {
cursor: this.cursor,
cateType: this.cateIdx || 0
},
fetchPolicy: 'network-only'
}).then(({ data: { paginatedPosts: { pageInfo, edges } } }) => {
this.posts = this.posts.concat(edges)
if (pageInfo.hasNext) {
this.cursor = pageInfo.after
$state.loaded() // 중간 지점 데이터 로드 완료시
} else {
$state.complete() // 최종 데이터 로드 완료시
}
})
}
// infiniteHandler ($state) {
// // Get Pagination Data
// this.$apollo.query({
// query: gql`${PaginationPosts}`,
// variables: {
// cateType: 2,
// cursor: this.cursor
// }
// }).then(({ data: { paginatedPosts: { pageInfo, edges } } }) => {
// this.posts = this.posts.concat(edges)
// if (pageInfo.hasNext) {
// this.cursor = pageInfo.after
// $state.loaded() // 중간 지점 데이터 로드 완료시
// } else {
// $state.complete() // 최종 데이터 로드 완료시
// }
// })
// },
}
}
</script>

0 comments on commit fc681ac

Please sign in to comment.