-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature] 프론트 요구사항에 맞춰, api 응답 Long id를 스트링으로 변경 및 신고 요청 dto 구분 #81
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
Open
Sehi55
wants to merge
6
commits into
develop
Choose a base branch
from
feature/api-id-report-contract
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
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
31 changes: 31 additions & 0 deletions
31
.../java/mannabom_server/manabom/application/report/dto/request/CreateChatReportRequest.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,31 @@ | ||
| package mannabom_server.manabom.application.report.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Positive; | ||
| import jakarta.validation.constraints.Size; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import mannabom_server.manabom.domain.report.entity.ReportReason; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class CreateChatReportRequest { | ||
|
|
||
| @NotNull(message = "채팅방 ID는 필수입니다.") | ||
| @Positive(message = "채팅방 ID는 0보다 커야 합니다.") | ||
| private Long contextId; | ||
|
|
||
| @NotNull(message = "신고 대상 사용자 ID는 필수입니다.") | ||
| @Positive(message = "신고 대상 사용자 ID는 0보다 커야 합니다.") | ||
| private Long targetId; | ||
|
|
||
| @NotNull(message = "신고 사유는 필수입니다.") | ||
| private ReportReason reason; | ||
|
|
||
| @Size(max = 1000, message = "신고 상세 내용은 최대 1000자까지 입력할 수 있습니다.") | ||
| private String additionalDetail; | ||
| } | ||
27 changes: 27 additions & 0 deletions
27
...va/mannabom_server/manabom/application/report/dto/request/CreateProfileReportRequest.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,27 @@ | ||
| package mannabom_server.manabom.application.report.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Positive; | ||
| import jakarta.validation.constraints.Size; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import mannabom_server.manabom.domain.report.entity.ReportReason; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class CreateProfileReportRequest { | ||
|
|
||
| @NotNull(message = "신고 대상 프로필 ID는 필수입니다.") | ||
| @Positive(message = "신고 대상 프로필 ID는 0보다 커야 합니다.") | ||
| private Long profileId; | ||
|
|
||
| @NotNull(message = "신고 사유는 필수입니다.") | ||
| private ReportReason reason; | ||
|
|
||
| @Size(max = 1000, message = "신고 상세 내용은 최대 1000자까지 입력할 수 있습니다.") | ||
| private String additionalDetail; | ||
| } |
12 changes: 0 additions & 12 deletions
12
...main/java/mannabom_server/manabom/application/report/dto/request/CreateReportRequest.java
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...in/java/mannabom_server/manabom/application/report/dto/response/CreateReportResponse.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,8 @@ | ||
| package mannabom_server.manabom.application.report.dto.response; | ||
|
|
||
| public record CreateReportResponse(Long reportId) { | ||
|
|
||
| public static CreateReportResponse of(Long reportId) { | ||
| return new CreateReportResponse(reportId); | ||
| } | ||
| } |
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
11 changes: 11 additions & 0 deletions
11
manabom/src/main/java/mannabom_server/manabom/domain/report/repository/ReportRepository.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
7 changes: 7 additions & 0 deletions
7
manabom/src/main/java/mannabom_server/manabom/domain/user/repository/UserRepository.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
18 changes: 18 additions & 0 deletions
18
manabom/src/main/java/mannabom_server/manabom/infrastructure/config/JacksonConfig.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,18 @@ | ||
| package mannabom_server.manabom.infrastructure.config; | ||
|
|
||
| import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
| import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| @Configuration | ||
| public class JacksonConfig { | ||
|
|
||
| @Bean | ||
| public Jackson2ObjectMapperBuilderCustomizer longAsStringCustomizer() { | ||
| return builder -> builder.serializerByType( | ||
| Long.class, | ||
| ToStringSerializer.instance | ||
| ); | ||
| } | ||
| } |
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
39 changes: 39 additions & 0 deletions
39
...a/mannabom_server/manabom/application/report/dto/request/ReportRequestValidationTest.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,39 @@ | ||
| package mannabom_server.manabom.application.report.dto.request; | ||
|
|
||
| import jakarta.validation.Validation; | ||
| import jakarta.validation.Validator; | ||
| import mannabom_server.manabom.domain.report.entity.ReportReason; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| class ReportRequestValidationTest { | ||
|
|
||
| private final Validator validator = Validation | ||
| .buildDefaultValidatorFactory() | ||
| .getValidator(); | ||
|
|
||
| @Test | ||
| void rejectsChatReportDetailLongerThanOneThousandCharacters() { | ||
| CreateChatReportRequest request = CreateChatReportRequest.builder() | ||
| .contextId(100L) | ||
| .targetId(2L) | ||
| .reason(ReportReason.ETC) | ||
| .additionalDetail("a".repeat(1001)) | ||
| .build(); | ||
|
|
||
| assertThat(validator.validate(request)) | ||
| .anyMatch(violation -> violation.getPropertyPath().toString() | ||
| .equals("additionalDetail")); | ||
| } | ||
|
|
||
| @Test | ||
| void allowsProfileReportWithoutAdditionalDetail() { | ||
| CreateProfileReportRequest request = CreateProfileReportRequest.builder() | ||
| .profileId(200L) | ||
| .reason(ReportReason.INAPPROPRIATE_PROFILE) | ||
| .build(); | ||
|
|
||
| assertThat(validator.validate(request)).isEmpty(); | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.