-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from MOONSHOT-Team/develop
[Deploy] v1.1.0 운영서버 배포
- Loading branch information
Showing
34 changed files
with
1,036 additions
and
168 deletions.
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
27 changes: 27 additions & 0 deletions
27
moonshot-api/src/main/java/org/moonshot/config/AsyncConfig.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.moonshot.config; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.AsyncConfigurer; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
|
||
@EnableAsync | ||
@Configuration | ||
public class AsyncConfig implements AsyncConfigurer { | ||
|
||
@Override | ||
public Executor getAsyncExecutor() { | ||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
executor.setCorePoolSize(4); | ||
executor.setMaxPoolSize(4); | ||
executor.setQueueCapacity(4); | ||
executor.setKeepAliveSeconds(60); | ||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); | ||
executor.setThreadNamePrefix("async-executor-"); | ||
executor.initialize(); | ||
return executor; | ||
} | ||
|
||
} |
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
12 changes: 2 additions & 10 deletions
12
moonshot-api/src/main/java/org/moonshot/objective/dto/response/HistoryResponseDto.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,20 +1,12 @@ | ||
package org.moonshot.objective.dto.response; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import org.moonshot.objective.model.Criteria; | ||
|
||
public record HistoryResponseDto( | ||
List<ObjectiveGroupByYearDto> groups, | ||
List<YearDto> years, | ||
List<String> categories | ||
) { | ||
public static HistoryResponseDto of(List<ObjectiveGroupByYearDto> groups, Map<Integer, Integer> years, | ||
List<String> categories, Criteria criteria) { | ||
return new HistoryResponseDto( | ||
groups, | ||
YearDto.of(years), | ||
categories.stream().distinct().toList() | ||
); | ||
public static HistoryResponseDto of(List<ObjectiveGroupByYearDto> groups, List<String> categories) { | ||
return new HistoryResponseDto(groups, categories.stream().distinct().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
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
35 changes: 35 additions & 0 deletions
35
moonshot-api/src/main/java/org/moonshot/user/service/UserSignUpService.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.moonshot.user.service; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.RequiredArgsConstructor; | ||
import org.moonshot.discord.SignUpEvent; | ||
import org.moonshot.user.model.User; | ||
import org.moonshot.user.repository.UserRepository; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UserSignUpService { | ||
|
||
private final UserRepository userRepository; | ||
private final ApplicationEventPublisher eventPublisher; | ||
|
||
@Async | ||
@Transactional(propagation = Propagation.REQUIRES_NEW) | ||
public void publishSignUpEvent(User user) { | ||
Long totalUserCount = userRepository.count(); | ||
eventPublisher.publishEvent(SignUpEvent.of( | ||
totalUserCount, | ||
user.getName(), | ||
user.getEmail() == null ? "" : user.getEmail(), | ||
user.getSocialPlatform().toString(), | ||
LocalDateTime.now(), | ||
user.getImageUrl() | ||
)); | ||
} | ||
|
||
} |
Oops, something went wrong.