-
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.
Browse files
Browse the repository at this point in the history
Feat/커뮤니티 게시글 사진 업로드 #256
- Loading branch information
Showing
4 changed files
with
79 additions
and
8 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
39 changes: 39 additions & 0 deletions
39
wingle/src/main/java/kr/co/wingle/community/article/ArticleImage.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 kr.co.wingle.community.article; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.ManyToOne; | ||
|
||
import org.springframework.util.Assert; | ||
|
||
import kr.co.wingle.common.entity.BaseEntity; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ArticleImage extends BaseEntity { | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Article article; | ||
|
||
@Column(nullable = false) | ||
private String imageUrl; | ||
|
||
@Column(nullable = false) | ||
private int orderNumber; | ||
|
||
@Builder | ||
ArticleImage(Article article, String imageUrl, int orderNumber) { | ||
Assert.notNull(article, "article must not be null"); | ||
Assert.notNull(imageUrl, "imageUrl must not be null"); | ||
|
||
this.article = article; | ||
this.imageUrl = imageUrl; | ||
this.orderNumber = orderNumber; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
wingle/src/main/java/kr/co/wingle/community/article/ArticleImageRepository.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,10 @@ | ||
package kr.co.wingle.community.article; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ArticleImageRepository extends JpaRepository<ArticleImage, Long> { | ||
|
||
List<ArticleImage> getArticleImagesByArticleIdAndIsDeletedOrderByOrderNumber(Long articleId, boolean isDeleted); | ||
} |
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