Skip to content
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

Feat/#60 View Server - Log 조회 서비스 및 API 구현 #62

Merged
merged 6 commits into from
Aug 15, 2024
Merged

Conversation

tidavid1
Copy link
Member

🚀 작업 내용

Warning

페이지네이션 적용 예정입니다!

  • Log 조회 서비스 및 API 구현

📸 이슈 번호

- Lombok 의존을 추가했습니다.
- MySQL R2DBC Driver를 추가했습니다.
- Log DB Entity를 구현했습니다.
  - DB Entity는 post-fix로 Data를 붙입니다.
- Log Domain Entity를 구현했습니다.
  - DB 엔티티와 매핑으로만 생성되도록 정적 팩토리 메서드를 활용했습니다.
- DB 엔티티와 도메인 엔티티를 매핑해주는 LogService를 구현했습니다.
- 이에 따른 테스트를 추가했습니다.
- AppKey 기반 조회 이후 결과를 반환하는 서비스 로직을 구현했습니다.
- 이에 따른 테스트를 추가했습니다.
- AppKey 기반 조회 이후 결과를 반환하는 API를 구현했습니다.
@tidavid1 tidavid1 added the ⭐️ Feat 새로운 기능이나 요청 label Aug 15, 2024
@tidavid1 tidavid1 self-assigned this Aug 15, 2024
@tidavid1 tidavid1 linked an issue Aug 15, 2024 that may be closed by this pull request
2 tasks
Copy link

Risk Level 2 - /home/runner/work/Team5-Guys/Team5-Guys/logbat_view/src/main/java/info/logbat_view/domain/log/presentation/LogViewController.java

The controller method 'getLogs' does not handle potential errors from 'logViewService.findLogs(appKey)'. Consider adding error handling to return appropriate HTTP responses. For example:

@GetMapping(\"/{appKey}\")
public Flux<ResponseEntity<LogCommonResponse>> getLogs(@PathVariable String appKey) {
    return logViewService.findLogs(appKey)
        .map(ResponseEntity::ok)
        .onErrorReturn(ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build());
}

Risk Level 2 - /home/runner/work/Team5-Guys/Team5-Guys/logbat_view/src/main/java/info/logbat_view/domain/log/application/LogViewService.java

The method 'findLogs' directly maps the result from 'logService.findLogsByAppKey(appKey)'. Consider adding error handling to manage potential exceptions from the service call. For example:

try {
    return logService.findLogsByAppKey(appKey).map(LogCommonResponse::from);
} catch (Exception e) {
    // Handle exception
}

🔍⚠️🛠️


Powered by Code Review GPT

Copy link
Member

@miiiinju1 miiiinju1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webflux 신기하네요!! 좋아요!

Comment on lines +9 to +20
@Getter
@Table("logs")
@AllArgsConstructor
public class LogData {

@Id
private Long logId;
private String appKey;
private String level;
private String data;
private LocalDateTime timestamp;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

궁금한 점:
jdbc로 제가 직접 UUID를 저장할 때는 binary로 고쳐서 넣었는데,
r2dbc를 사용했을 때, 해당 작업이 자동으로 일어나는지 궁금합니다!!

DB Column이 BINARY(16)으로 지정되어 있습니다!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

누락된것 같습니다! :C
리팩토링 이슈에서 추가하도록 하겠습니다 :D

Copy link
Member

@LuizyHub LuizyHub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

불변성 객체로 변경 여부 한번 검토 부탁드립니다!

Spring Data Relational / Introduction / Object Mapping Fundamentals / General recommendations


@Getter
@Table("logs")
@AllArgsConstructor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 단일 생성자를 통해서 객체를 생성하는 것 같아 final 을 사용해서 불변성 객체로 만들면 어떨지 제안드립니다!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리팩 이슈에서 반영하도록 하겠습니다!

Copy link
Member

@LuizyHub LuizyHub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 잘 봤습니다!

@tidavid1 tidavid1 merged commit 385eda8 into dev Aug 15, 2024
1 check passed
@tidavid1 tidavid1 deleted the feat/#60 branch August 15, 2024 09:06
LuizyHub pushed a commit that referenced this pull request Aug 19, 2024
* init: 의존성 추가

- Lombok 의존을 추가했습니다.
- MySQL R2DBC Driver를 추가했습니다.

* feat: Log DB Entity 구현

- Log DB Entity를 구현했습니다.
  - DB Entity는 post-fix로 Data를 붙입니다.

* feat: Log Domain Entity 구현

- Log Domain Entity를 구현했습니다.
  - DB 엔티티와 매핑으로만 생성되도록 정적 팩토리 메서드를 활용했습니다.

* feat: Log Domain Mapping Service 구현

- DB 엔티티와 도메인 엔티티를 매핑해주는 LogService를 구현했습니다.
- 이에 따른 테스트를 추가했습니다.

* feat: Log 조회 기능 구현 - 서비스

- AppKey 기반 조회 이후 결과를 반환하는 서비스 로직을 구현했습니다.
- 이에 따른 테스트를 추가했습니다.

* feat: Log 조회 기능 구현 - API

- AppKey 기반 조회 이후 결과를 반환하는 API를 구현했습니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐️ Feat 새로운 기능이나 요청
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[💡 FEAT] View Server - Log 조회 서비스 및 API 구현
3 participants