-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Move-Log/develop
Merge develop to main
- Loading branch information
Showing
9 changed files
with
200 additions
and
2 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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/movelog/domain/news/domain/repository/NewsRepository.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,9 +1,27 @@ | ||
package com.movelog.domain.news.domain.repository; | ||
|
||
import com.movelog.domain.news.domain.News; | ||
import com.movelog.domain.user.domain.User; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Repository | ||
public interface NewsRepository extends JpaRepository<News, Long> { | ||
|
||
@Query("SELECT n FROM News n " + | ||
"JOIN n.keyword k " + | ||
"WHERE k.user = :user " + | ||
"AND n.createdAt > :createdAt " + | ||
"ORDER BY n.createdAt DESC") | ||
List<News> findRecentNewsByUser( | ||
@Param("user") User user, | ||
@Param("createdAt") LocalDateTime createdAt, | ||
Pageable pageable | ||
); | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/movelog/domain/news/dto/response/RecentNewsRes.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,36 @@ | ||
package com.movelog.domain.news.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class RecentNewsRes { | ||
|
||
@Schema( type = "int", example ="1", description="뉴스 ID") | ||
private Long newsId; | ||
|
||
@Schema( type = "String", example ="https://movelog.s3.ap-northeast-2.amazonaws.com/record/2021-08-01/1.jpg", description="뉴스 이미지 url") | ||
private String newsImageUrl; | ||
|
||
@Schema( type = "String", example ="5년 만의 첫 도전, 무엇이 그를 움직이게 했나?", description="뉴스 헤드라인 추천 내용입니다.") | ||
private String headLine; | ||
|
||
@Schema( type = "String", example = "헬스", description="명사") | ||
private String noun; | ||
|
||
@Schema( type = "String", example = "했어요", description="동사") | ||
private String verb; | ||
|
||
@Schema( type = "LocalDateTime", example ="2021-08-01T00:00:00", description="뉴스 생성 시간") | ||
private LocalDateTime createdAt; | ||
|
||
|
||
} |
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
16 changes: 16 additions & 0 deletions
16
src/main/java/com/movelog/domain/record/dto/request/SearchKeywordReq.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,16 @@ | ||
package com.movelog.domain.record.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class SearchKeywordReq { | ||
@Schema( type = "String", example ="헬스", description="검색할 명사") | ||
private String searchKeyword; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/movelog/domain/record/dto/response/SearchKeywordRes.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,24 @@ | ||
package com.movelog.domain.record.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class SearchKeywordRes { | ||
|
||
@Schema( type = "int", example = "1", description="키워드 ID") | ||
private Long keywordId; | ||
|
||
@Schema( type = "String", example ="헬스", description="검색어가 포함된 명사") | ||
private String noun; | ||
|
||
@Schema( type = "String", example ="했어요", description="명사에 해당하는 동사") | ||
private String verb; | ||
|
||
} |
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