Skip to content

Commit 9c25193

Browse files
authored
fix: 제휴 지도 & 신고 기능 수정 사항 (20250930) (#249)
* chore: DS 파일 git ignore * refactor: 만료된 제휴가 보이지 않도록 수정 * feat: 24시간 이내에 댓글 신고 횟수 제한 * refactor: 스웨거 문서 업데이트 * chore: CI/CD test * chore: CI/CD test * fix: 공백 제거 * fix: CI/CD 수정 완료 * fix: gemini 수정 사항 반영 * fix: writtenAt 필드 수정 --------- Co-authored-by: 나용준 <141994188+youngJun99@users.noreply.github.com>
1 parent 00d1409 commit 9c25193

8 files changed

Lines changed: 39 additions & 13 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
sudo docker run -d -p 9000:9000 \
113113
--log-driver=json-file \
114114
--log-opt max-size=20m \
115-
--log-opt max-file=5 \
115+
--log-opt max-file=5 \
116116
-e EATSSU_DB_URL_DEV="${{ secrets.EATSSU_DB_URL_DEV }}" \
117117
-e EATSSU_DB_USERNAME="${{ secrets.EATSSU_DB_USERNAME }}" \
118118
-e EATSSU_DB_PASSWORD="${{ secrets.EATSSU_DB_PASSWORD }}" \

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ out/
4545
### env file ###
4646
.env
4747

48-
/src/main/resources/application-local.yml
48+
/src/main/resources/application-local.yml
49+
50+
### DS File ###
51+
.DS_Store
52+
*/.DS_Store

src/main/java/ssu/eatssu/domain/partnership/persistence/PartnershipRestaurantRepository.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
public interface PartnershipRestaurantRepository extends JpaRepository<PartnershipRestaurant, Long> {
1010
@Query("""
11-
SELECT DISTINCT pr FROM PartnershipRestaurant pr
12-
LEFT JOIN FETCH pr.partnerships p
13-
LEFT JOIN FETCH p.partnershipCollege
14-
LEFT JOIN FETCH p.partnershipDepartment
15-
WHERE p.endDate is null or p.endDate >= CURRENT_DATE""")
11+
SELECT DISTINCT pr FROM PartnershipRestaurant pr
12+
JOIN FETCH pr.partnerships p
13+
LEFT JOIN FETCH p.partnershipCollege
14+
LEFT JOIN FETCH p.partnershipDepartment
15+
WHERE p.endDate IS NULL OR p.endDate >= CURRENT_DATE
16+
""")
1617
List<PartnershipRestaurant> findAllWithDetails();
1718
}

src/main/java/ssu/eatssu/domain/report/dto/ReportCreateRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ public record ReportCreateRequest(
99
@Schema(description = "신고할 리뷰 id", example = "4")
1010
Long reviewId,
1111

12-
@Schema(description = "신고 타입", example = "BAD_WORD")
12+
@Schema(description = "신고 타입", example = "NO_ASSOCIATE_CONTENT")
1313
ReportType reportType,
1414

15-
@Schema(description = "신고 내용", example = "음란성, 욕설 등 부적절한 내용")
15+
@Schema(description = "신고 내용", example = "리뷰 작성 취지에 맞지 않는 내용")
1616
String content) {
1717

1818
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
package ssu.eatssu.domain.report.repository;
22

33
import org.springframework.data.jpa.repository.JpaRepository;
4+
import org.springframework.data.jpa.repository.Query;
5+
import org.springframework.data.repository.query.Param;
46
import ssu.eatssu.domain.review.entity.Report;
57

8+
import java.time.LocalDateTime;
9+
610
public interface ReportRepository extends JpaRepository<Report, Long> {
11+
12+
@Query("""
13+
SELECT count(r) > 0
14+
FROM Report r
15+
WHERE r.user.id = :userId
16+
AND r.review.id = :reviewId
17+
AND r.createdDate >= :threshold
18+
""")
19+
boolean existsRecentReport(@Param("userId") Long userId,
20+
@Param("reviewId") Long reviewId,
21+
@Param("threshold") LocalDateTime threshold);
722
}

src/main/java/ssu/eatssu/domain/report/service/ReportService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import ssu.eatssu.global.handler.response.BaseException;
1818
import ssu.eatssu.global.log.event.LogEvent;
1919

20-
import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_REVIEW;
21-
import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER;
20+
import java.time.LocalDateTime;
21+
22+
import static ssu.eatssu.global.handler.response.BaseResponseStatus.*;
2223

2324
@RequiredArgsConstructor
2425
@Service
@@ -37,6 +38,10 @@ public Report reportReview(CustomUserDetails userDetails, ReportCreateRequest re
3738
Review review = reviewRepository.findById(request.reviewId())
3839
.orElseThrow(() -> new BaseException(NOT_FOUND_REVIEW));
3940

41+
if(reportRepository.existsRecentReport(user.getId(), review.getId(), LocalDateTime.now().minusHours(24))){
42+
throw new BaseException(RECENT_REPORT_ON_REVIEW);
43+
}
44+
4045
Report report = Report.create(user, review, request, ReportStatus.PENDING);
4146
reportRepository.save(report);
4247

src/main/java/ssu/eatssu/domain/review/dto/ReviewDetail.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ReviewDetail {
3939
private Integer rating;
4040

4141
@Schema(description = "리뷰 작성 날짜(format = yyyy-MM-dd)", example = "2023-04-07")
42-
private LocalDate writedAt;
42+
private LocalDate writtenAt;
4343

4444
@Schema(description = "리뷰 내용", example = "맛있습니당")
4545
private String content;
@@ -61,7 +61,7 @@ public static ReviewDetail from(Review review, Long userId) {
6161
ReviewDetailBuilder builder = ReviewDetail.builder()
6262
.reviewId(review.getId())
6363
.rating(review.getRatings().getMainRating())
64-
.writedAt(review.getCreatedDate().toLocalDate())
64+
.writtenAt(review.getCreatedDate().toLocalDate())
6565
.content(review.getContent())
6666
.imageUrls(imageUrls)
6767
.menu(new MenuIdNameLikeDto(menu.getId(),menu.getName(),likedMenuIds.contains(menu.getId())));

src/main/java/ssu/eatssu/global/handler/response/BaseResponseStatus.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public enum BaseResponseStatus {
3131
EXISTED_MEAL(false, HttpStatus.BAD_REQUEST, 40011, "이미 존재하는 식단입니다."),
3232
INVALID_TARGET_TYPE(false, HttpStatus.BAD_REQUEST, 40012, "잘못된 targetType 입니다."),
3333
MISSING_USER_DEPARTMENT(false, HttpStatus.BAD_REQUEST, 40013, "사용자의 학과 정보가 없습니다."),
34+
RECENT_REPORT_ON_REVIEW(false, HttpStatus.BAD_REQUEST, 40014, "24시간 이내에 동일 댓글을 신고했습니다."),
3435

3536
/**
3637
* 401 UNAUTHORIZED 권한없음(인증 실패)

0 commit comments

Comments
 (0)