-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: 어드민 히스토리 기능 수정 #1131
Merged
Merged
fix: 어드민 히스토리 기능 수정 #1131
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bb4b9c1
fix: 반환 날짜 형식 변경
Soundbar91 e341850
feat: 검색 정렬 옵션 추가
Soundbar91 5d869bf
fix: String 필드 Enum으로 변경
Soundbar91 416bffe
style: 코드 포멧팅
Soundbar91 53090e8
chore: 미사용 import 삭제
Soundbar91 95e0528
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Soundbar91 c1563ec
style: 코드 포멧팅
Soundbar91 e138734
chore: 코드 블럭 처리
Soundbar91 6b2693d
chore: historys -> histories으로 변경
Soundbar91 d8cf385
chore: 정적 메소드 네이밍 변경
Soundbar91 cdddd14
style: 코드 개행
Soundbar91 0f756c2
style: 코드 개행
Soundbar91 6628b34
fix: 충돌 해결
Soundbar91 7c1ecb2
fix: 로깅 어노테이션으로 변경
Soundbar91 4fddc05
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Soundbar91 ee8ea95
Merge branch 'develop' of https://github.com/BCSDLab/KOIN_API_V2 into…
Soundbar91 7d1052c
Revert "fix: 로깅 어노테이션으로 변경"
Soundbar91 c5958df
chore: 리뷰 반영
Soundbar91 0a93a54
style: 코드 포멧팅
Soundbar91 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 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
34 changes: 26 additions & 8 deletions
34
...n/history/dto/AdminHistorysCondition.java → .../history/dto/AdminHistoriesCondition.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,38 +1,56 @@ | ||
package in.koreatech.koin.admin.history.dto; | ||
|
||
import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import static in.koreatech.koin.global.model.Criteria.*; | ||
import static in.koreatech.koin.global.model.Criteria.Sort.CREATED_AT_ASC; | ||
import static in.koreatech.koin.global.model.Criteria.Sort.CREATED_AT_DESC; | ||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; | ||
import static org.springframework.data.domain.Sort.Direction; | ||
|
||
import java.util.Objects; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import in.koreatech.koin.global.model.Criteria; | ||
import in.koreatech.koin.admin.history.enums.DomainType; | ||
import in.koreatech.koin.admin.history.enums.HttpMethodType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@JsonNaming(value = SnakeCaseStrategy.class) | ||
public record AdminHistorysCondition( | ||
public record AdminHistoriesCondition( | ||
@Schema(description = "페이지", example = "1", defaultValue = "1", requiredMode = NOT_REQUIRED) | ||
Integer page, | ||
|
||
@Schema(description = "페이지당 조회할 최대 개수", example = "10", defaultValue = "10", requiredMode = NOT_REQUIRED) | ||
Integer limit, | ||
|
||
@Schema(description = "HTTP 메소드", example = "POST", requiredMode = NOT_REQUIRED) | ||
String requestMethod, | ||
HttpMethodType requestMethod, | ||
|
||
@Schema(description = "도메인 이름", example = "NOTICE", requiredMode = NOT_REQUIRED) | ||
String domainName, | ||
DomainType domainName, | ||
|
||
@Schema(description = "특정 엔티티 id", requiredMode = NOT_REQUIRED) | ||
Integer domainId | ||
Integer domainId, | ||
|
||
@Schema(description = "정렬 기준", requiredMode = NOT_REQUIRED) | ||
Sort sort | ||
) { | ||
public AdminHistorysCondition { | ||
public AdminHistoriesCondition { | ||
if (Objects.isNull(page)) { | ||
page = Criteria.DEFAULT_PAGE; | ||
page = DEFAULT_PAGE; | ||
} | ||
if (Objects.isNull(limit)) { | ||
limit = Criteria.DEFAULT_LIMIT; | ||
limit = DEFAULT_LIMIT; | ||
} | ||
if (Objects.isNull(sort)) { | ||
sort = CREATED_AT_DESC; | ||
} | ||
} | ||
|
||
public Direction getSortDir() { | ||
if (sort == CREATED_AT_ASC) { | ||
return Direction.ASC; | ||
} | ||
return Direction.DESC; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,13 +12,11 @@ | |
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import in.koreatech.koin.admin.history.enums.DomainType; | ||
import in.koreatech.koin.admin.history.enums.HttpMethodType; | ||
import in.koreatech.koin.admin.history.model.AdminActivityHistory; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@JsonNaming(value = SnakeCaseStrategy.class) | ||
public record AdminHistorysResponse( | ||
public record AdminHistoriesResponse( | ||
@Schema(description = "조건에 해당하는 히스토리 수", example = "10", requiredMode = REQUIRED) | ||
Long totalCount, | ||
|
||
|
@@ -32,10 +30,10 @@ public record AdminHistorysResponse( | |
Integer currentPage, | ||
|
||
@Schema(description = "어드민 계정 리스트", requiredMode = REQUIRED) | ||
List<InnerAdminHistorysResponse> historys | ||
List<InnerAdminHistoriesResponse> histories | ||
) { | ||
@JsonNaming(value = SnakeCaseStrategy.class) | ||
public record InnerAdminHistorysResponse( | ||
public record InnerAdminHistoriesResponse( | ||
@Schema(description = "고유 id", example = "1", requiredMode = REQUIRED) | ||
Integer id, | ||
|
||
|
@@ -61,31 +59,31 @@ public record InnerAdminHistorysResponse( | |
) | ||
String requestMessage, | ||
|
||
@Schema(description = "요청 시간", example = "2019-08-16-23-01-52", requiredMode = REQUIRED) | ||
@JsonFormat(pattern = "yyyy-MM-dd-HH-mm-ss") | ||
@Schema(description = "요청 시간", example = "2019-08-16 23:01:52", requiredMode = REQUIRED) | ||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
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. A훨씬 깔끔해진 거 같네요 |
||
LocalDateTime createdAt | ||
) { | ||
public static InnerAdminHistorysResponse from(AdminActivityHistory adminActivityHistory) { | ||
return new InnerAdminHistorysResponse( | ||
public static InnerAdminHistoriesResponse from(AdminActivityHistory adminActivityHistory) { | ||
return new InnerAdminHistoriesResponse( | ||
adminActivityHistory.getId(), | ||
adminActivityHistory.getDomainId(), | ||
adminActivityHistory.getAdmin().getUser().getName(), | ||
DomainType.valueOf(adminActivityHistory.getDomainName()).getDescription(), | ||
HttpMethodType.valueOf(adminActivityHistory.getRequestMethod()).getValue(), | ||
adminActivityHistory.getDomainName().getDescription(), | ||
adminActivityHistory.getRequestMethod().getValue(), | ||
adminActivityHistory.getRequestMessage(), | ||
adminActivityHistory.getCreatedAt() | ||
); | ||
} | ||
} | ||
|
||
public static AdminHistorysResponse of(Page<AdminActivityHistory> adminActivityHistoryPage) { | ||
return new AdminHistorysResponse( | ||
public static AdminHistoriesResponse from(Page<AdminActivityHistory> adminActivityHistoryPage) { | ||
return new AdminHistoriesResponse( | ||
adminActivityHistoryPage.getTotalElements(), | ||
adminActivityHistoryPage.getContent().size(), | ||
adminActivityHistoryPage.getTotalPages(), | ||
adminActivityHistoryPage.getNumber() + 1, | ||
adminActivityHistoryPage.getContent().stream() | ||
.map(InnerAdminHistorysResponse::from) | ||
.map(InnerAdminHistoriesResponse::from) | ||
.collect(Collectors.toList()) | ||
); | ||
} | ||
|
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
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.
A
static import는 좋은데, 위는 CREATED_AT_DESC는 static import를 사용하고, 아래의 Sort.CREATED_AT_ASC를 사용한다면 조금 모호하게 의미파악이 되지 않을까 생각이 드네요👀
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.
밑에도 static import로 변경하겠습니다 !