-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kahluaband:main' into main
- Loading branch information
Showing
11 changed files
with
220 additions
and
12 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
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
31 changes: 31 additions & 0 deletions
31
src/main/java/kahlua/KahluaProject/domain/post/PostLikes.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,31 @@ | ||
package kahlua.KahluaProject.domain.post; | ||
|
||
import jakarta.persistence.*; | ||
import kahlua.KahluaProject.domain.BaseEntity; | ||
import kahlua.KahluaProject.domain.user.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Builder | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "postLikes") | ||
public class PostLikes extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name="like_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private 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
39 changes: 39 additions & 0 deletions
39
src/main/java/kahlua/KahluaProject/dto/post/response/PostGetResponse.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,39 @@ | ||
package kahlua.KahluaProject.dto.post.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Builder | ||
public class PostGetResponse { | ||
|
||
@Schema(description = "아이디(번호)", example = "1") | ||
private Long id; | ||
|
||
@Schema(description = "게시글 제목", example = "2024년 9월 정기공연") | ||
private String title; | ||
|
||
@Schema(description = "게시글 내용", example = "안녕하세요 깔루아 기장입니다. 감사합니다.") | ||
private String content; | ||
|
||
@Schema(description = "게시글 작성자", example = "관리자") | ||
private String writer; | ||
|
||
@Schema(description = "게시글 좋아요 수", example = "13") | ||
private int likes; | ||
|
||
//게시글 댓글 수 | ||
|
||
@Schema(description = "게시글 사진 리스트", example = "https://bucketname.s3.region.amazonaws.com/image1.jpg") | ||
private List<PostImageGetResponse> imageUrls; | ||
|
||
@Schema(description = "작성한 날짜", example = "2024-08-01T00:00:00") | ||
private LocalDateTime created_at; | ||
|
||
@Schema(description = "수정한 날짜", example = "2024-08-10T00:00:00") | ||
private LocalDateTime updated_at; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/kahlua/KahluaProject/dto/post/response/PostImageGetResponse.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 kahlua.KahluaProject.dto.post.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class PostImageGetResponse { | ||
|
||
@Schema(description = "id") | ||
private Long id; | ||
|
||
@Schema(description = "image url") | ||
private String url; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/kahlua/KahluaProject/repository/post/PostLikesRepository.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,14 @@ | ||
package kahlua.KahluaProject.repository.post; | ||
|
||
import kahlua.KahluaProject.domain.post.Post; | ||
import kahlua.KahluaProject.domain.post.PostLikes; | ||
import kahlua.KahluaProject.domain.user.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface PostLikesRepository extends JpaRepository<PostLikes, Long> { | ||
|
||
// boolean existsByPostAndUser(Post); | ||
Optional<PostLikes> findByPostAndUser(Post post, User user); | ||
} |
6 changes: 5 additions & 1 deletion
6
...luaProject/repository/PostRepository.java → ...oject/repository/post/PostRepository.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,7 +1,11 @@ | ||
package kahlua.KahluaProject.repository; | ||
package kahlua.KahluaProject.repository.post; | ||
|
||
import kahlua.KahluaProject.domain.post.Post; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface PostRepository extends JpaRepository<Post, Long> { | ||
|
||
Optional<Post> findById(Long id); | ||
} |
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