-
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.
# Conflicts: # src/main/java/com/mpnp/baechelin/review/service/ReviewService.java
- Loading branch information
Showing
11 changed files
with
163 additions
and
49 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
34 changes: 34 additions & 0 deletions
34
src/main/java/com/mpnp/baechelin/bookmark/dto/BookmarkPagedResponseDto.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,34 @@ | ||
package com.mpnp.baechelin.bookmark.dto; | ||
|
||
import com.mpnp.baechelin.bookmark.domain.Bookmark; | ||
import com.mpnp.baechelin.store.domain.Store; | ||
import com.mpnp.baechelin.store.dto.StoreCardResponseDto; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.data.domain.Page; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public class BookmarkPagedResponseDto { | ||
private boolean hasNextPage; | ||
private long totalCount; | ||
private long leftElement; | ||
private int page; | ||
private int totalPage; | ||
private List<BookmarkInfoDto> cards; | ||
|
||
public BookmarkPagedResponseDto(Page<Bookmark> resultStoreList) { | ||
this.hasNextPage = resultStoreList.hasNext(); | ||
this.totalPage = resultStoreList.getTotalPages() - 1; | ||
this.cards = resultStoreList.get().collect(Collectors.toList()).stream().map(BookmarkInfoDto::new).collect(Collectors.toList()); | ||
this.totalCount = resultStoreList.getTotalElements(); | ||
this.page = resultStoreList.getNumber(); | ||
this.leftElement = totalCount - (long) page * resultStoreList.getSize() - resultStoreList.getNumberOfElements(); | ||
this.leftElement = this.leftElement < 0 ? 0 : this.leftElement; | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/mpnp/baechelin/review/dto/ReviewRequestDto.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,20 +1,52 @@ | ||
package com.mpnp.baechelin.review.dto; | ||
|
||
import lombok.*; | ||
import org.hibernate.validator.constraints.Length; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.ArrayList; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.Size; | ||
import java.util.List; | ||
|
||
|
||
@Getter @Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@Valid | ||
public class ReviewRequestDto { | ||
//review 테이블 컬럼 | ||
private long storeId; //업장 아이디 | ||
@NotBlank(message = "내용을 입력해주세요") | ||
@Length(min = 20, max = 200, message = "20자 이상, 200자 이하로 작성해주세요") | ||
private String content; //리뷰 코멘트 | ||
private double point; //별점 | ||
private List<String> tagList; //태그 | ||
private List<MultipartFile> imageFile; //리뷰 이미지 사진 | ||
|
||
public List<String> Tags() { | ||
|
||
List<String> tags = new ArrayList<>(); | ||
|
||
tags.add("bKiosk"); | ||
tags.add("bTable"); | ||
tags.add("bWheelchair"); | ||
tags.add("bHelp"); | ||
tags.add("bMenu"); | ||
tags.add("bAutoDoor"); | ||
tags.add("fDelicious"); | ||
tags.add("fClean"); | ||
tags.add("fVibe"); | ||
tags.add("fQuantity"); | ||
tags.add("fGoodToEat"); | ||
tags.add("fPrice"); | ||
|
||
return tags; | ||
} | ||
|
||
} |
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.