-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'article-develop' into feature/#1538-아티클_좋아요_기능_추가
- Loading branch information
Showing
24 changed files
with
593 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
backend/src/main/java/wooteco/prolog/article/domain/ArticleFilterType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package wooteco.prolog.article.domain; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ArticleFilterType { | ||
ALL(""), | ||
ANDROID("안드로이드"), | ||
BACKEND("백엔드"), | ||
FRONTEND("프론트엔드"); | ||
|
||
private final String groupName; | ||
|
||
ArticleFilterType(String groupName) { | ||
this.groupName = groupName; | ||
} | ||
} |
23 changes: 20 additions & 3 deletions
23
backend/src/main/java/wooteco/prolog/article/domain/repository/ArticleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
package wooteco.prolog.article.domain.repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import wooteco.prolog.article.domain.Article; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface ArticleRepository extends JpaRepository<Article, Long> { | ||
|
||
List<Article> findAllByOrderByCreatedAtDesc(); | ||
|
||
@Query("select a from Article a join fetch a.articleBookmarks where a.id = :id") | ||
|
||
|
||
Optional<Article> findFetchBookmarkById(@Param("id") final Long id); | ||
|
||
@Query("select a from Article a join fetch a.articleLikes where a.id = :id") | ||
Optional<Article> findFetchLikeById(@Param("id") final Long id); | ||
} | ||
|
||
Optional<Article> findFetchById(@Param("id") final Long id); | ||
|
||
@Query("SELECT DISTINCT a FROM Article a " + | ||
"JOIN GroupMember gm ON a.member.id = gm.member.id " + | ||
"JOIN gm.group mg " + | ||
"WHERE mg.name LIKE %:course") | ||
List<Article> findArticlesByCourse(@Param("course") String course); | ||
|
||
@Query("SELECT DISTINCT a FROM Article a " + | ||
"JOIN GroupMember gm ON a.member.id = gm.member.id " + | ||
"JOIN gm.group mg " + | ||
"JOIN a.articleBookmarks.articleBookmarks ab " + | ||
"WHERE mg.name LIKE %:course AND ab.memberId = :memberId") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.