-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: Post 관련 테스트 메소드 네이밍 수정 * fix: boardFixture 메소드로 가져오도록 수정 및 usedBoard 필드 추가 * fix: 게시판 조회 쿼리문 수정 * refactor: 엔티티 생성하는 메소드 내부로 분리 * test: 정상적인 boardId, MemberId가 주어졌다면 게시글 쓰기가 성공하는 테스트 코드 작성 * test: 정상적인 boardId, MemberId가 주어졌다면 게시글 쓰기가 성공합니다.(이미지 O) * test: 유효하지 않은 boardID가 주어졌다면 게시글 쓰기에 예외를 발생하는 테스트 코드 구현 * test: 유효하지 않은 memberId가 주어졌다면 게시글 쓰기에 예외를 발생하는 테스트 코드 구현
- Loading branch information
Showing
12 changed files
with
578 additions
and
346 deletions.
There are no files selected for viewing
27 changes: 15 additions & 12 deletions
27
src/main/java/com/ssafy/ssafsound/domain/board/dto/GetBoardElement.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,23 +1,26 @@ | ||
package com.ssafy.ssafsound.domain.board.dto; | ||
|
||
import com.ssafy.ssafsound.domain.board.domain.Board; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class GetBoardElement { | ||
private Long boardId; | ||
private String title; | ||
private String imageUrl; | ||
private String description; | ||
private Long boardId; | ||
private String title; | ||
private String imageUrl; | ||
private Boolean usedBoard; | ||
private String description; | ||
|
||
public static GetBoardElement from(Board board) { | ||
return GetBoardElement.builder() | ||
.boardId(board.getId()) | ||
.title(board.getTitle()) | ||
.imageUrl(board.getImageUrl()) | ||
.description(board.getDescription()) | ||
.build(); | ||
} | ||
public static GetBoardElement from(Board board) { | ||
return GetBoardElement.builder() | ||
.boardId(board.getId()) | ||
.title(board.getTitle()) | ||
.imageUrl(board.getImageUrl()) | ||
.usedBoard(board.getUsedBoard()) | ||
.description(board.getDescription()) | ||
.build(); | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/java/com/ssafy/ssafsound/domain/board/repository/BoardRepository.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,12 @@ | ||
package com.ssafy.ssafsound.domain.board.repository; | ||
|
||
import java.util.List; | ||
|
||
import com.ssafy.ssafsound.domain.board.domain.Board; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface BoardRepository extends JpaRepository<Board, Long> { | ||
List<Board> findAllByUsedBoardTrue(); | ||
} |
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
47 changes: 31 additions & 16 deletions
47
src/main/java/com/ssafy/ssafsound/domain/post/domain/PostImage.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,34 +1,49 @@ | ||
package com.ssafy.ssafsound.domain.post.domain; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity(name="post_image") | ||
@Entity(name = "post_image") | ||
@Getter | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class PostImage { | ||
|
||
@Id | ||
@Column(name = "post_image_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
@Id | ||
@Column(name = "post_image_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
@Column | ||
private String imagePath; | ||
|
||
@Column | ||
private String imagePath; | ||
@Column | ||
private String imageUrl; | ||
|
||
@Column | ||
private String imageUrl; | ||
@Column | ||
private Integer renderOrder; | ||
|
||
@Column | ||
private Integer renderOrder; | ||
public static PostImage of(Post post, String imagePath, String imageUrl) { | ||
return PostImage.builder() | ||
.post(post) | ||
.imagePath(imagePath) | ||
.imageUrl(imageUrl) | ||
.build(); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/main/java/com/ssafy/ssafsound/domain/post/dto/ImageInfo.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
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.