-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 모임방/기록/투표/오늘의 한마디 신고 API 추가 #376
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
src/main/java/konkuk/thip/room/adapter/in/web/response/RoomReportResponse.java
This file contains hidden or 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,12 @@ | ||
| package konkuk.thip.room.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.room.application.port.in.dto.RoomReportResult; | ||
|
|
||
| public record RoomReportResponse( | ||
| Long roomId, | ||
| int reportCount | ||
| ) { | ||
| public static RoomReportResponse of(RoomReportResult roomReportResult) { | ||
| return new RoomReportResponse(roomReportResult.roomId(), roomReportResult.reportCount()); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
7 changes: 7 additions & 0 deletions
7
src/main/java/konkuk/thip/room/application/port/in/RoomReportUseCase.java
This file contains hidden or 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 konkuk.thip.room.application.port.in; | ||
|
|
||
| import konkuk.thip.room.application.port.in.dto.RoomReportResult; | ||
|
|
||
| public interface RoomReportUseCase { | ||
| RoomReportResult reportRoom(Long roomId); | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/konkuk/thip/room/application/port/in/dto/RoomReportResult.java
This file contains hidden or 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,10 @@ | ||
| package konkuk.thip.room.application.port.in.dto; | ||
|
|
||
| public record RoomReportResult( | ||
| Long roomId, | ||
| int reportCount | ||
| ) { | ||
| public static RoomReportResult of(Long roomId, int reportCount) { | ||
| return new RoomReportResult(roomId, reportCount); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
src/main/java/konkuk/thip/room/application/service/RoomReportService.java
This file contains hidden or 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,26 @@ | ||
| package konkuk.thip.room.application.service; | ||
|
|
||
| import konkuk.thip.room.application.port.in.RoomReportUseCase; | ||
| import konkuk.thip.room.application.port.in.dto.RoomReportResult; | ||
| import konkuk.thip.room.application.port.out.RoomCommandPort; | ||
| import konkuk.thip.room.domain.Room; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class RoomReportService implements RoomReportUseCase { | ||
|
|
||
| private final RoomCommandPort roomCommandPort; | ||
|
|
||
| @Override | ||
| @Transactional | ||
| public RoomReportResult reportRoom(Long roomId) { | ||
| Room room = roomCommandPort.getByIdOrThrow(roomId); | ||
| room.increaseReportCount(); | ||
| roomCommandPort.update(room); | ||
|
|
||
| return RoomReportResult.of(room.getId(), room.getReportCount()); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
...main/java/konkuk/thip/roompost/adapter/in/web/response/AttendanceCheckReportResponse.java
This file contains hidden or 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,12 @@ | ||
| package konkuk.thip.roompost.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.roompost.application.port.in.dto.attendancecheck.AttendanceCheckReportResult; | ||
|
|
||
| public record AttendanceCheckReportResponse( | ||
| Long attendanceCheckId, | ||
| int reportCount | ||
| ) { | ||
| public static AttendanceCheckReportResponse of(AttendanceCheckReportResult attendanceCheckReportResult) { | ||
| return new AttendanceCheckReportResponse(attendanceCheckReportResult.attendanceCheckId(), attendanceCheckReportResult.reportCount()); | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/konkuk/thip/roompost/adapter/in/web/response/RecordReportResponse.java
This file contains hidden or 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,12 @@ | ||
| package konkuk.thip.roompost.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.roompost.application.port.in.dto.record.RecordReportResult; | ||
|
|
||
| public record RecordReportResponse( | ||
| Long recordId, | ||
| int reportCount | ||
| ) { | ||
| public static RecordReportResponse of(RecordReportResult recordReportResult) { | ||
| return new RecordReportResponse(recordReportResult.recordId(), recordReportResult.reportCount()); | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/konkuk/thip/roompost/adapter/in/web/response/VoteReportResponse.java
This file contains hidden or 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,12 @@ | ||
| package konkuk.thip.roompost.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.roompost.application.port.in.dto.vote.VoteReportResult; | ||
|
|
||
| public record VoteReportResponse( | ||
| Long voteId, | ||
| int reportCount | ||
| ) { | ||
| public static VoteReportResponse of(VoteReportResult voteReportResult) { | ||
| return new VoteReportResponse(voteReportResult.voteId(), voteReportResult.reportCount()); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
중첩 경로의
roomId소속을 검증하십시오.세 엔드포인트는
{roomId}를 받지만 use case에는 하위 리소스 ID만 전달합니다. 따라서POST /rooms/A/record/B/report에서 기록 B가 방 A에 속하지 않아도 B의 신고 횟수가 증가합니다. 하위 리소스의 방 ID가 경로의roomId와 다르면 대상 없음 오류를 반환하도록 use case 계약과 서비스를 변경하십시오.src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L92-L102:roomId와recordId를 함께 use case에 전달하십시오.src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L168-L178:roomId와voteId를 함께 use case에 전달하십시오.src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L213-L225:roomId와attendanceCheckId를 함께 use case에 전달하십시오.src/test/java/konkuk/thip/roompost/adapter/in/web/RecordReportApiTest.java#L106-L118: 다른 방에 속한 기록을 신고하면 404를 반환하고 신고 횟수를 변경하지 않는 테스트를 추가하십시오.📍 Affects 2 files
src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L92-L102(this comment)src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L168-L178src/main/java/konkuk/thip/roompost/adapter/in/web/RoomPostCommandController.java#L213-L225src/test/java/konkuk/thip/roompost/adapter/in/web/RecordReportApiTest.java#L106-L118🤖 Prompt for AI Agents