Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new substitution logic in the message sending flow to replace template variables with corresponding region names. Key changes include:
- Enhancements to SendMessageRequestDTO with additional constructors and a withText method.
- New methods in MessageServiceImpl to process and replace template keys before sending messages.
- An added repository query in RegionRepository to fetch region names based on a key.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apiserver/service/src/main/java/com/zipline/service/message/dto/request/SendMessageRequestDTO.java | Added annotations and a withText method for text substitution. |
| apiserver/service/src/main/java/com/zipline/service/message/MessageServiceImpl.java | Introduced template value replacement logic and integrated it into the sendMessage flow. |
| apiserver/infrastructure/src/main/java/com/zipline/repository/region/RegionRepository.java | Added a new query for fetching the region name based on a provided key. |
| if (regionRepository.findCortarNameByCortarNo(key) == null) { | ||
| return key; | ||
| } | ||
| return regionRepository.findCortarNameByCortarNo(key); |
There was a problem hiding this comment.
Consider storing the result of regionRepository.findCortarNameByCortarNo(key) in a variable to avoid performing the same database lookup twice.
| if (regionRepository.findCortarNameByCortarNo(key) == null) { | |
| return key; | |
| } | |
| return regionRepository.findCortarNameByCortarNo(key); | |
| String cortarName = regionRepository.findCortarNameByCortarNo(key); | |
| if (cortarName == null) { | |
| return key; | |
| } | |
| return cortarName; |
| } | ||
|
|
||
| @Query("SELECT r.cortarName FROM Region r WHERE r.cortarNo = :cortarNo") | ||
| String findCortarNameByCortarNo(@Param("cortarNo") String cortarNoText); |
There was a problem hiding this comment.
[nitpick] Since the region's identifier is numeric in other parts of the repository, consider converting the key to a numeric type (e.g., Long) before querying, or ensure that this type mismatch is intentional.
Dsys1129
left a comment
There was a problem hiding this comment.
확인했습니다.
if (regionRepository.findCortarNameByCortarNo(key) == null) {
return key;
}
return regionRepository.findCortarNameByCortarNo(key);
이 쿼리 두번나가는 로직만 수정하시면 될 것 같아요
74ed3db to
da93b7c
Compare
#️⃣연관된 이슈
#410
📝작업 내용
📸 스크린샷 (선택)
💬리뷰 요구사항(선택)