-
Notifications
You must be signed in to change notification settings - Fork 3
[release] be #1080
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
[release] be #1080
Changes from all commits
3d46373
6924014
3382f54
5746e9d
63d4f33
bd7f557
5a4a806
88b0539
6b013cd
9ca2b98
498fb72
773bada
7bb7517
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| import moadong.global.util.ObjectIdConverter; | ||
| import moadong.user.payload.CustomUserDetails; | ||
| import org.bson.types.ObjectId; | ||
| import org.javers.core.Javers; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
|
|
@@ -23,27 +24,31 @@ public class ClubProfileService { | |
|
|
||
| private final ClubRepository clubRepository; | ||
| private final ClubSearchRepository clubSearchRepository; | ||
| private final RecruitmentStateCalculator recruitmentStateCalculator; | ||
| private final Javers javers; | ||
|
|
||
| @Transactional | ||
| public void updateClubInfo(ClubInfoRequest request, CustomUserDetails user) { | ||
| Club club = clubRepository.findClubByUserId(user.getId()) | ||
| .orElseThrow(() -> new RestApiException(ErrorCode.CLUB_NOT_FOUND)); | ||
| club.update(request); | ||
| clubRepository.save(club); | ||
| Club saved = clubRepository.save(club); | ||
| javers.commit(user.getUsername(), saved); | ||
| } | ||
|
|
||
| public void updateClubRecruitmentInfo(ClubRecruitmentInfoUpdateRequest request, | ||
| CustomUserDetails user) { | ||
| Club club = clubRepository.findClubByUserId(user.getId()) | ||
| .orElseThrow(() -> new RestApiException(ErrorCode.CLUB_NOT_FOUND)); | ||
| club.update(request); | ||
| RecruitmentStateCalculator.calculate( | ||
| recruitmentStateCalculator.calculate( | ||
| club, | ||
| club.getClubRecruitmentInformation().getRecruitmentStart(), | ||
| club.getClubRecruitmentInformation().getRecruitmentEnd() | ||
| ); | ||
| club.getClubRecruitmentInformation().updateLastModifiedDate(); | ||
| clubRepository.save(club); | ||
| Club saved = clubRepository.save(club); | ||
| javers.commit(user.getUsername(), saved); | ||
| } | ||
|
Comment on lines
39
to
52
Contributor
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. 🧩 Analysis chain🏁 Script executed: # First, let's examine the ClubProfileService class to check for transaction annotations
find . -type f -name "ClubProfileService.java" | head -5Repository: Moadong/moadong Length of output: 127 🏁 Script executed: # Also, let's look at the file structure to better understand the project
git ls-files | grep -E "(Service|Repository)" | head -20Repository: Moadong/moadong Length of output: 1442 🏁 Script executed: # Let's check for common transaction management patterns in the codebase
rg "@Transactional" --type java | head -20Repository: Moadong/moadong Length of output: 1805 🏁 Script executed: # Let's examine the ClubProfileService class to see its structure and annotations
cat -n backend/src/main/java/moadong/club/service/ClubProfileService.javaRepository: Moadong/moadong Length of output: 3211 @transactional 어노테이션 누락으로 인한 데이터 불일치 위험 메서드가 비트랜잭션 상태이기 때문에 🔧 예시(트랜잭션 적용)- public void updateClubRecruitmentInfo(ClubRecruitmentInfoUpdateRequest request,
+ `@Transactional`
+ public void updateClubRecruitmentInfo(ClubRecruitmentInfoUpdateRequest request,🤖 Prompt for AI Agents |
||
|
|
||
| public ClubDetailedResponse getClubDetail(String clubId) { | ||
|
|
@@ -57,3 +62,4 @@ public ClubDetailedResponse getClubDetail(String clubId) { | |
| return new ClubDetailedResponse(clubDetailedResult); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| package moadong.fcm.util; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.beans.factory.annotation.Value; | ||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.stereotype.Component; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| @Component | ||||||||||||||||||||||||||||||||||||||||||||
| public class FcmTopicResolver { | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| @Value("${spring.profiles.active:prod}") | ||||||||||||||||||||||||||||||||||||||||||||
| private String activeProfile; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| public String resolveTopic(String clubId) { | ||||||||||||||||||||||||||||||||||||||||||||
| if ("prod".equals(activeProfile)) { | ||||||||||||||||||||||||||||||||||||||||||||
| return clubId; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| return activeProfile + "_" + clubId; | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+16
Contributor
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. 🧩 Analysis chain🏁 Script executed: # Find and read the FcmTopicResolver.java file
find . -name "FcmTopicResolver.java" -type fRepository: Moadong/moadong Length of output: 121 🏁 Script executed: # Also check the directory structure to understand the project layout
ls -la backend/src/main/java/moadong/fcm/util/ 2>/dev/null || echo "Path not found, searching..."
find . -type f -name "*.java" -path "*/fcm/util/*" | head -20Repository: Moadong/moadong Length of output: 300 🌐 Web query:
💡 Result: Short answer: spring.profiles.active accepts a comma-separated list (e.g. --spring.profiles.active=dev,metrics) and activates all listed profiles. Spring will load profile-specific configuration/beans for each active profile; when the same property is defined in multiple active profiles, later entries override earlier ones (i.e. precedence depends on order). Use spring.profiles.include or profile groups to add/compose profiles if needed. [1][2] Sources: 🏁 Script executed: # Read the FcmTopicResolver.java file completely
cat -n ./backend/src/main/java/moadong/fcm/util/FcmTopicResolver.javaRepository: Moadong/moadong Length of output: 626 🏁 Script executed: # Search for any other usages of activeProfile or resolveTopic in the codebase
rg "resolveTopic|activeProfile" --type java -B 2 -A 2Repository: Moadong/moadong Length of output: 2764 멀티 프로파일 환경에서 토픽 라우팅이 실패합니다.
🔧 제안 수정 public String resolveTopic(String clubId) {
- if ("prod".equals(activeProfile)) {
+ String profile = (activeProfile == null || activeProfile.isBlank())
+ ? "prod"
+ : activeProfile;
+ boolean isProd = java.util.Arrays.stream(profile.split(","))
+ .map(String::trim)
+ .anyMatch(p -> p.equalsIgnoreCase("prod"));
+ if (isProd) {
return clubId;
}
- return activeProfile + "_" + clubId;
+ String prefix = profile.split(",")[0].trim();
+ return prefix + "_" + clubId;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package moadong.global.config; | ||
|
|
||
| import org.javers.core.Javers; | ||
| import org.javers.core.JaversBuilder; | ||
| import org.javers.repository.mongo.MongoRepository; | ||
| import org.javers.spring.auditable.AuthorProvider; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.data.mongodb.MongoDatabaseFactory; | ||
| import org.springframework.security.core.context.SecurityContextHolder; | ||
| import org.springframework.transaction.PlatformTransactionManager; | ||
|
|
||
| @Configuration | ||
| public class JaversConfig { | ||
| @Bean | ||
| public AuthorProvider authorProvider() { | ||
| return () -> { | ||
| return SecurityContextHolder.getContext().getAuthentication().getName(); | ||
| }; | ||
|
Comment on lines
+16
to
+19
Contributor
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. 인증 정보 없을 때 NPE 방지 필요 🔧 제안 수정 `@Bean`
public AuthorProvider authorProvider() {
- return () -> {
- return SecurityContextHolder.getContext().getAuthentication().getName();
- };
+ return () -> {
+ var auth = SecurityContextHolder.getContext().getAuthentication();
+ return (auth != null && auth.isAuthenticated()) ? auth.getName() : "system";
+ };
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| @Bean | ||
| public MongoRepository javersMongoRepository(MongoDatabaseFactory dbFactory) { | ||
| // MongoDatabaseFactory에서 database 객체를 꺼내서 Javers에 넘김 | ||
| return new MongoRepository(dbFactory.getMongoDatabase()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package moadong.log.club.controller; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import moadong.log.club.payload.response.ClubHistoryResponse; | ||
| import moadong.log.club.service.ClubHistoryService; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/clubs") | ||
| @RequiredArgsConstructor | ||
| public class ClubHistoryController { | ||
| private final ClubHistoryService clubHistoryService; | ||
|
|
||
| @GetMapping("/{clubId}/histories") | ||
| public ResponseEntity<List<ClubHistoryResponse>> getClubHistories(@PathVariable String clubId) { | ||
| List<ClubHistoryResponse> histories = clubHistoryService.getClubHistories(clubId); | ||
| return ResponseEntity.ok(histories); | ||
| } | ||
| } |
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.
FCM 실패 로그에 예외 스택트레이스 포함
현재는 메시지만 남아서 원인 추적이 어렵습니다. 예외 객체를 함께 로깅해 주세요.
🔧 제안 수정
🤖 Prompt for AI Agents