forked from EveryUniv/next-student-council-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #12 from gutanbug/feat/trade
feat: 단국 거래 서비스 단일 조회, 판매 완료 기능 추가
- Loading branch information
Showing
18 changed files
with
435 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
|
||
public enum LikeTarget { | ||
POST, | ||
COMMENT | ||
COMMENT, | ||
WITH_DANKOOK | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/dku/council/domain/with_dankook/exception/ImageSizeExceededException.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,11 @@ | ||
package com.dku.council.domain.with_dankook.exception; | ||
|
||
import com.dku.council.global.error.exception.LocalizedMessageException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class ImageSizeExceededException extends LocalizedMessageException { | ||
|
||
public ImageSizeExceededException() { | ||
super(HttpStatus.BAD_REQUEST, "invalid.imagesize"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...main/java/com/dku/council/domain/with_dankook/exception/WithDankookNotFoundException.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,11 @@ | ||
package com.dku.council.domain.with_dankook.exception; | ||
|
||
import com.dku.council.global.error.exception.LocalizedMessageException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class WithDankookNotFoundException extends LocalizedMessageException { | ||
|
||
public WithDankookNotFoundException() { | ||
super(HttpStatus.NOT_FOUND, "notfound.withdankook"); | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
...n/java/com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleTradeDto.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,43 @@ | ||
package com.dku.council.domain.with_dankook.model.dto.response; | ||
|
||
import com.dku.council.domain.with_dankook.model.dto.TradeImageDto; | ||
import com.dku.council.domain.with_dankook.model.entity.type.Trade; | ||
import com.dku.council.infra.nhn.s3.service.ObjectUploadContext; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import org.springframework.context.MessageSource; | ||
import org.springframework.context.i18n.LocaleContextHolder; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
public class ResponseSingleTradeDto extends ResponseSingleWithDankookDto { | ||
|
||
@Schema(description = "제목", example = "물물교환") | ||
private final String title; | ||
|
||
@Schema(description = "가격", example = "10000") | ||
private final int price; | ||
|
||
@Schema(description = "내용", example = "게시글 본문") | ||
private final String content; | ||
|
||
@Schema(description = "거래 장소", example = "단국대학교 정문") | ||
private final String tradePlace; | ||
|
||
@Schema(description = "이미지 목록") | ||
private final List<TradeImageDto> images; | ||
|
||
@Schema(description = "거래 상태", example = "거래중") | ||
private final String status; | ||
|
||
public ResponseSingleTradeDto(ResponseSingleWithDankookDto dto, Trade trade, ObjectUploadContext context, MessageSource messageSource) { | ||
super(dto); | ||
this.title = trade.getTitle(); | ||
this.price = trade.getPrice(); | ||
this.content = trade.getContent(); | ||
this.tradePlace = trade.getTradePlace(); | ||
this.images = TradeImageDto.listOf(context, trade.getImages()); | ||
this.status = messageSource.getMessage("withdankook.trade." + trade.getWithDankookStatus().name().toLowerCase(), null, LocaleContextHolder.getLocale()); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
.../com/dku/council/domain/with_dankook/model/dto/response/ResponseSingleWithDankookDto.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,57 @@ | ||
package com.dku.council.domain.with_dankook.model.dto.response; | ||
|
||
import com.dku.council.domain.with_dankook.model.entity.WithDankook; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
public class ResponseSingleWithDankookDto { | ||
|
||
@Schema(description = "게시글 아이디", example = "1") | ||
private final Long id; | ||
|
||
@Schema(description = "작성자", example = "익명") | ||
private final String author; | ||
|
||
@Schema(description = "생성 날짜") | ||
private final LocalDateTime createdAt; | ||
|
||
@Schema(description = "채팅 링크", example = "https://open.kakao.com/o/ghjgjgjg") | ||
private final String chatLink; | ||
|
||
@Schema(description = "좋아요 수", example = "26") | ||
private final int likes; | ||
|
||
@Schema(description = "내가 쓴 게시물인지?", example = "true") | ||
private final boolean isMine; | ||
|
||
@Schema(description = "내가 좋아요를 눌렀는지?", example = "false") | ||
private final boolean isLiked; | ||
|
||
@Schema(description = "닫힘 여부", example = "false") | ||
private final boolean isClosed; | ||
|
||
public ResponseSingleWithDankookDto(int likes, boolean isMine, boolean isLiked, WithDankook withDankook) { | ||
this.id = withDankook.getId(); | ||
this.author = withDankook.getDisplayingUsername(); | ||
this.createdAt = withDankook.getCreatedAt(); | ||
this.chatLink = withDankook.getChatLink(); | ||
this.likes = likes; | ||
this.isMine = isMine; | ||
this.isLiked = isLiked; | ||
this.isClosed = withDankook.isClosed(); | ||
} | ||
|
||
public ResponseSingleWithDankookDto(ResponseSingleWithDankookDto copy) { | ||
this.id = copy.id; | ||
this.author = copy.author; | ||
this.createdAt = copy.createdAt; | ||
this.chatLink = copy.chatLink; | ||
this.likes = copy.likes; | ||
this.isMine = copy.isMine; | ||
this.isLiked = copy.isLiked; | ||
this.isClosed = copy.isClosed; | ||
} | ||
} |
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.