-
Notifications
You must be signed in to change notification settings - Fork 1
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 #15 from whatever-mentoring/feature/3-getPost
[feature/3-getPost] ์ฅฌ์๊ธ ์์ธ ์กฐํ API
- Loading branch information
Showing
10 changed files
with
131 additions
and
13 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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/ewhatever/qna/comment/repository/CommentRepository.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,11 +1,15 @@ | ||
package com.ewhatever.qna.comment.repository; | ||
|
||
import com.ewhatever.qna.comment.entity.Comment; | ||
import com.ewhatever.qna.post.entity.Post; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface CommentRepository extends JpaRepository<Comment, Long> { | ||
Long countByWriter_UserIdxAndStatusEquals(Long userIdx, String status); | ||
Page<Comment> findByWriter_UserIdxAndStatusEquals(Long userIdx, String status, Pageable pageable); | ||
List<Comment> findAllByPost(Post post); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
package com.ewhatever.qna.common; | ||
|
||
public class Constant { | ||
public static final String ACTIVE = "active"; | ||
public static final String INACTIVE = "inactive"; | ||
public static final String LOGOUT = "logout"; | ||
public static class Status { | ||
public static final String ACTIVE = "active"; | ||
public static final String INACTIVE = "inactive"; | ||
public static final String LOGOUT = "logout"; | ||
} | ||
|
||
public static class Role { | ||
public static final String SENIOR = "senior"; | ||
public static final String JUNIOR = "junior"; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.ewhatever.qna.post.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class GetPostRes { | ||
private String category; | ||
private List<String> cardList; // ์ง๋ฌธ ์ ๋ชฉ, ์ง๋ฌธ ์์ธ, ๋ต๋ณ(0-3๊ฐ) | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy.MM.dd", timezone = "Asia/Seoul") | ||
private LocalDateTime date; | ||
private Long commentCount; | ||
private Long scrapCount; | ||
private Boolean isScrap; | ||
private List<CommentDto> commentList; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class CommentDto { | ||
private String writer; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy.MM.dd HH:mm", timezone = "Asia/Seoul") | ||
private LocalDateTime date; | ||
private String content; | ||
private Boolean isWriter; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
3 changes: 3 additions & 0 deletions
3
src/main/java/com/ewhatever/qna/scrap/repository/ScrapRepository.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,11 +1,14 @@ | ||
package com.ewhatever.qna.scrap.repository; | ||
|
||
import com.ewhatever.qna.post.entity.Post; | ||
import com.ewhatever.qna.scrap.entity.Scrap; | ||
import com.ewhatever.qna.user.entity.User; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ScrapRepository extends JpaRepository<Scrap, Long> { | ||
Long countByUser_UserIdxAndStatusEquals(Long userIdx, String status); | ||
Page<Scrap> findByUser_UserIdxAndStatusEquals(Long userIdx, String status, Pageable pageable); | ||
Boolean existsByPostAndUserAndStatusEquals(Post post, User user, String status); | ||
} |