-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#37 리뷰 관련 기능 구현(ocr제외) #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
fc729dc
2e3099b
93253f5
6d03bb1
532a1e9
84b8a2e
f693364
233485e
999d9e5
233fd66
19a216f
0985830
6adb5b7
6bc5713
3e68965
b0a2afe
a41398e
fc132dd
7fe95d4
0c33ec3
3e2ce01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record SavedPlaceInfo( | ||
|
|
||
|
|
@@ -32,6 +33,7 @@ public record SavedPlaceInfo( | |
| String telephone, | ||
|
|
||
| @Schema(description = "위도/경도") | ||
| @NotNull | ||
|
||
| Coordinate coordinate, | ||
|
|
||
| @Schema(description = "이미지 url") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,6 @@ | |
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import com.campus.campus.domain.councilpost.application.dto.request.PostRequest; | ||
| import com.campus.campus.domain.place.application.dto.response.LikeResponse; | ||
| import com.campus.campus.domain.place.application.dto.response.SavedPlaceInfo; | ||
| import com.campus.campus.domain.place.application.dto.response.SearchCandidateResponse; | ||
|
|
@@ -113,8 +112,7 @@ public List<SavedPlaceInfo> search(double lat, double lng, String keyword) { | |
| } | ||
|
|
||
| @Transactional | ||
|
||
| public Place findOrCreatePlace(PostRequest request) { | ||
| SavedPlaceInfo place = request.place(); | ||
| public Place findOrCreatePlace(SavedPlaceInfo place) { | ||
| String placeKey = place.placeKey(); | ||
|
|
||
| //이미 Place 존재하는지 확인 후 없으면 객체 생성 후 저장 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.campus.campus.domain.review.application.dto.request; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import com.campus.campus.domain.place.application.dto.response.SavedPlaceInfo; | ||
|
|
||
|
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: fd -t f ReviewRequest.javaRepository: our-campUS/our-campUS-BE Length of output: 192 🏁 Script executed: find . -type f -name "SavedPlaceInfo.java"Repository: our-campUS/our-campUS-BE Length of output: 159 🏁 Script executed: find . -type f -name "PlaceRequest.java"Repository: our-campUS/our-campUS-BE Length of output: 50 🏁 Script executed: cat -n src/main/java/com/campus/campus/domain/review/application/dto/request/ReviewRequest.javaRepository: our-campUS/our-campUS-BE Length of output: 1899 🏁 Script executed: cat -n src/main/java/com/campus/campus/domain/place/application/dto/response/SavedPlaceInfo.javaRepository: our-campUS/our-campUS-BE Length of output: 1418 요청 DTO가 응답 DTO(
🤖 Prompt for AI Agents |
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| public record ReviewRequest( | ||
|
|
||
| @NotNull | ||
| @Size(min = 20, message = "리뷰 내용은 최소 20자 이상이어야 합니다.") | ||
| @Schema(example = "아주 정말 맛있습니다. 저의 완전 짱 또간집. 꼭꼮꼬꼬꼭 가세요.") | ||
| String content, | ||
|
|
||
| @NotNull | ||
| @Schema(example = "3.5") | ||
| double star, | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| List<String> imageUrls, | ||
|
|
||
| @Schema(example = | ||
| """ | ||
| "placeName": "숙명여자대학교", | ||
| "placeKey": "string", | ||
| "address": "서울특별시 용산구 청파로47길 99", | ||
| "category": "교육,학문>대학교", | ||
| "link": "https://map.naver.com/v5/search/%EC%88%99%EB%AA%85%EC%97%AC%EC%9E%90%EB%8C%80%ED%95%99%EA%B5%90+%EC%A0%9C1%EC%BA%A0%ED%8D%BC%EC%8A%A4?c=37.545947,126.964578,15,0,0,0,dh", | ||
| "telephone": "010-1234-1234", | ||
| "coordinate": { | ||
| "latitude": 0.1, | ||
| "longitude": 0.1 | ||
| }, | ||
| "imgUrls": [ | ||
| "string" | ||
| ] | ||
| """, | ||
| description = "/search API에서 반환된 결과 중 하나를 선택") | ||
|
Comment on lines
+29
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -type f -name "ReviewRequest.java" | head -20Repository: our-campUS/our-campUS-BE Length of output: 158 🏁 Script executed: cat -n ./src/main/java/com/campus/campus/domain/review/application/dto/request/ReviewRequest.java | sed -n '20,50p'Repository: our-campUS/our-campUS-BE Length of output: 1120 🏁 Script executed: find . -type f -name "SavedPlaceInfo.java" | head -5Repository: our-campUS/our-campUS-BE Length of output: 159 🏁 Script executed: cat -n ./src/main/java/com/campus/campus/domain/place/application/dto/response/SavedPlaceInfo.javaRepository: our-campUS/our-campUS-BE Length of output: 1418
최상위 제안 수정 @Schema(example =
"""
- "placeName": "숙명여자대학교",
- "placeKey": "string",
- "address": "서울특별시 용산구 청파로47길 99",
- "category": "교육,학문>대학교",
- "link": "https://map.naver.com/v5/search/%EC%88%99%EB%AA%85%EC%97%AC%EC%9E%90%EB%8C%80%ED%95%99%EA%B5%90+%EC%A0%9C1%EC%BA%A0%ED%8D%BC%EC%8A%A4?c=37.545947,126.964578,15,0,0,0,dh",
- "telephone": "010-1234-1234",
- "coordinate": {
- "latitude": 0.1,
- "longitude": 0.1
- },
- "imgUrls": [
- "string"
- ]
+ {
+ "placeName": "숙명여자대학교",
+ "placeKey": "string",
+ "address": "서울특별시 용산구 청파로47길 99",
+ "category": "교육,학문>대학교",
+ "link": "https://map.naver.com/v5/search/%EC%88%99%EB%AA%85%EC%97%AC%EC%9E%90%EB%8C%80%ED%95%99%EA%B5%90+%EC%A0%9C1%EC%BA%A0%ED%8D%BC%EC%8A%A4?c=37.545947,126.964578,15,0,0,0,dh",
+ "telephone": "010-1234-1234",
+ "coordinate": { "latitude": 0.1, "longitude": 0.1 },
+ "imgUrls": ["string"]
+ }
""",
description = "/search API에서 반환된 결과 중 하나를 선택")🤖 Prompt for AI Agents |
||
| @NotNull | ||
| @Valid | ||
| SavedPlaceInfo place | ||
|
Comment on lines
+29
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Schema 예시 JSON 형식이 올바르지 않습니다.
📝 수정 제안 @Schema(example =
"""
- "placeName": "숙명여자대학교",
+ {
+ "placeName": "숙명여자대학교",
"placeKey": "string",
"address": "서울특별시 용산구 청파로47길 99",
"category": "교육,학문>대학교",
"link": "https://map.naver.com/v5/search/...",
"telephone": "010-1234-1234",
"coordinate": {
"latitude": 0.1,
"longitude": 0.1
},
"imgUrls": [
"string"
]
- """,
+ }
+ """,
description = "/search API에서 반환된 결과 중 하나를 선택")🤖 Prompt for AI Agents |
||
|
|
||
| ) { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| public class CursorPageReviewResponse<ReviewResponse> { | ||
|
|
||
| private List<ReviewResponse> items; | ||
| private String nextCursorCreatedAt; | ||
| private Long nextCursorId; | ||
| private boolean hasNext; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record PlaceReviewRankResponse( | ||
| Long placeId, | ||
| String placeName, | ||
| String category, | ||
| String partnership, | ||
| String thumbnailUrl | ||
| // double distance | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record RankingScope( | ||
| String scope, | ||
| long rank //n번째 리뷰 | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record ReviewCreateResponse( | ||
| ReviewResponse review, | ||
| ReviewCreateResult result, | ||
| ReviewRankingResponse ranking | ||
|
|
||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record ReviewCreateResult( | ||
| boolean isFirstReviewOfPlace, | ||
| int userReviewCountOfPlace, | ||
| // int NumberOfUserStamp, | ||
| String message | ||
|
||
| ) { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| public record ReviewRankingResponse( | ||
| RankingScope major, | ||
| RankingScope college, | ||
| RankingScope school | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package com.campus.campus.domain.review.application.dto.response; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record ReviewResponse( | ||
| Long id, | ||
| Long userId, | ||
| String userName, | ||
| LocalDate createDate, | ||
| Long placeId, | ||
| String content, | ||
| double star, | ||
| List<String> imageUrls | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package com.campus.campus.domain.review.application.exception; | ||
|
|
||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| import com.campus.campus.global.common.exception.ErrorCodeInterface; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum ErrorCode implements ErrorCodeInterface { | ||
|
|
||
| REVIEW_NOT_FOUND(2700, HttpStatus.NOT_FOUND, "게시글을 찾을 수 없습니다."), | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| NOT_REVIEW_WRITER(2701, HttpStatus.FORBIDDEN, "작성자만 해당 작업을 수행할 수 있습니다."); | ||
|
|
||
| private final int code; | ||
| private final HttpStatus status; | ||
| private final String message; | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.review.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class NotUserWriterException extends ApplicationException { | ||
| public NotUserWriterException() { | ||
| super(ErrorCode.NOT_REVIEW_WRITER); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.review.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class ReviewNotFoundException extends ApplicationException { | ||
| public ReviewNotFoundException() { | ||
| super(ErrorCode.REVIEW_NOT_FOUND); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.