-
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.
- Loading branch information
Showing
9 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/org/prgrms/nabimarketbe/domain/card/dto/request/CardCreateRequestDTO.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,22 @@ | ||
package org.prgrms.nabimarketbe.domain.card.dto.request; | ||
|
||
import org.prgrms.nabimarketbe.domain.card.entity.TradeType; | ||
import org.prgrms.nabimarketbe.domain.cardimage.dto.request.CardImageCreateRequestDTO; | ||
import org.prgrms.nabimarketbe.domain.category.entity.CategoryEnum; | ||
import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; | ||
|
||
import java.util.List; | ||
|
||
public record CardCreateRequestDTO( | ||
String title, | ||
String thumbNailImage, | ||
String name, | ||
PriceRange priceRange, | ||
TradeType tradeType, | ||
CategoryEnum category, | ||
String tradeArea, | ||
Boolean pokeAvailable, | ||
String content, | ||
List<CardImageCreateRequestDTO> images | ||
) { | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/org/prgrms/nabimarketbe/domain/card/dto/response/CardCreateResponseDTO.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,65 @@ | ||
package org.prgrms.nabimarketbe.domain.card.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.prgrms.nabimarketbe.domain.card.entity.TradeType; | ||
import org.prgrms.nabimarketbe.domain.cardimage.dto.response.CardImageCreateResponseDTO; | ||
import org.prgrms.nabimarketbe.domain.category.entity.CategoryEnum; | ||
import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Builder | ||
public record CardCreateResponseDTO( | ||
Long cardId, | ||
String title, | ||
String thumbNailImage, | ||
String name, | ||
PriceRange priceRange, | ||
TradeType tradeType, | ||
CategoryEnum category, | ||
String tradeArea, | ||
Boolean pokeAvailable, | ||
String content, | ||
Integer viewCount, | ||
Integer dibCount, | ||
LocalDateTime createdAt, | ||
LocalDateTime modifiedAt, | ||
List<CardImageCreateResponseDTO> images | ||
) { | ||
public static CardCreateResponseDTO of( | ||
Long cardId, | ||
String title, | ||
String thumbNailImage, | ||
String name, | ||
PriceRange priceRange, | ||
TradeType tradeType, | ||
CategoryEnum category, | ||
String tradeArea, | ||
Boolean pokeAvailable, | ||
String content, | ||
Integer viewCount, | ||
Integer dibCount, | ||
LocalDateTime createdAt, | ||
LocalDateTime modifiedAt, | ||
List<CardImageCreateResponseDTO> images | ||
) { | ||
return CardCreateResponseDTO.builder() | ||
.cardId(cardId) | ||
.title(title) | ||
.thumbNailImage(thumbNailImage) | ||
.name(name) | ||
.priceRange(priceRange) | ||
.tradeType(tradeType) | ||
.category(category) | ||
.tradeArea(tradeArea) | ||
.pokeAvailable(pokeAvailable) | ||
.content(content) | ||
.viewCount(viewCount) | ||
.dibCount(dibCount) | ||
.createdAt(createdAt) | ||
.modifiedAt(modifiedAt) | ||
.images(images) | ||
.build(); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...main/java/org/prgrms/nabimarketbe/domain/card/dto/response/CardSingleReadResponseDTO.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,59 @@ | ||
package org.prgrms.nabimarketbe.domain.card.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.prgrms.nabimarketbe.domain.card.entity.CardStatus; | ||
import org.prgrms.nabimarketbe.domain.card.entity.TradeType; | ||
import org.prgrms.nabimarketbe.domain.cardimage.dto.response.CardImageSingleReadResponseDTO; | ||
import org.prgrms.nabimarketbe.domain.category.entity.CategoryEnum; | ||
import org.prgrms.nabimarketbe.domain.item.entity.PriceRange; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record CardSingleReadResponseDTO( | ||
Long cardId, | ||
String cardTitle, | ||
String content, | ||
String tradeArea, | ||
Boolean pokeAvailable, | ||
TradeType tradeType, | ||
CardStatus status, | ||
Integer viewCount, | ||
Integer dibCount, | ||
String itemName, | ||
CategoryEnum category, | ||
PriceRange priceRange, | ||
List<CardImageSingleReadResponseDTO> images | ||
) { | ||
public static CardSingleReadResponseDTO of( | ||
Long cardId, | ||
String cardTitle, | ||
String content, | ||
String tradeArea, | ||
Boolean pokeAvailable, | ||
TradeType tradeType, | ||
CardStatus status, | ||
Integer viewCount, | ||
Integer dibCount, | ||
String itemName, | ||
CategoryEnum category, | ||
PriceRange priceRange, | ||
List<CardImageSingleReadResponseDTO> images | ||
) { | ||
return CardSingleReadResponseDTO.builder() | ||
.cardId(cardId) | ||
.cardTitle(cardTitle) | ||
.content(content) | ||
.tradeArea(tradeArea) | ||
.pokeAvailable(pokeAvailable) | ||
.tradeType(tradeType) | ||
.status(status) | ||
.viewCount(viewCount) | ||
.dibCount(dibCount) | ||
.itemName(itemName) | ||
.category(category) | ||
.priceRange(priceRange) | ||
.images(images) | ||
.build(); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/main/java/org/prgrms/nabimarketbe/domain/card/entity/Card.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,69 @@ | ||
package org.prgrms.nabimarketbe.domain.card.entity; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.prgrms.nabimarketbe.global.BaseEntity; | ||
import org.prgrms.nabimarketbe.domain.item.entity.Item; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
|
||
@Entity | ||
@Table | ||
@Getter | ||
@NoArgsConstructor | ||
public class Card extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long cardId; | ||
|
||
@NotNull @NotBlank | ||
private String cardTitle; | ||
|
||
private String thumbNailImage; | ||
|
||
@Lob | ||
private String content; | ||
|
||
private String tradeArea; | ||
|
||
private Boolean poke; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private TradeType tradeType; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private CardStatus status; | ||
|
||
private Integer viewCount; | ||
|
||
private Integer dibCount; | ||
|
||
@OneToOne | ||
@JoinColumn(name = "item_id") | ||
private Item item; | ||
|
||
@Builder | ||
public Card( | ||
String cardTitle, | ||
String thumbNailImage, | ||
String content, | ||
String tradeArea, | ||
Boolean poke, | ||
TradeType tradeType, | ||
Item item | ||
) { | ||
this.cardTitle = cardTitle; | ||
this.thumbNailImage = thumbNailImage; | ||
this.content = content; | ||
this.tradeArea = tradeArea; | ||
this.poke = poke; | ||
this.tradeType = tradeType; | ||
this.status = CardStatus.TRADE_AVAILABLE; | ||
this.viewCount = 0; | ||
this.dibCount = 0; | ||
this.item = item; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/prgrms/nabimarketbe/domain/card/entity/CardStatus.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,7 @@ | ||
package org.prgrms.nabimarketbe.domain.card.entity; | ||
|
||
public enum CardStatus { | ||
TRADE_AVAILABLE, | ||
RESERVED, | ||
TRADE_COMPLETE | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/org/prgrms/nabimarketbe/domain/card/entity/TradeType.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,6 @@ | ||
package org.prgrms.nabimarketbe.domain.card.entity; | ||
|
||
public enum TradeType { | ||
DIRECT_DEALING, | ||
SHIPPING | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepository.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,7 @@ | ||
package org.prgrms.nabimarketbe.domain.card.repository; | ||
|
||
import org.prgrms.nabimarketbe.domain.card.entity.Card; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface CardRepository extends JpaRepository<Card, Long>, CardRepositoryCustom { | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryCustom.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,5 @@ | ||
package org.prgrms.nabimarketbe.domain.card.repository; | ||
|
||
public interface CardRepositoryCustom { | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/prgrms/nabimarketbe/domain/card/repository/CardRepositoryImpl.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,4 @@ | ||
package org.prgrms.nabimarketbe.domain.card.repository; | ||
|
||
public class CardRepositoryImpl implements CardRepositoryCustom { | ||
} |