-
Notifications
You must be signed in to change notification settings - Fork 6
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 #303 from JNU-econovation/be
[BE] merge to main
- Loading branch information
Showing
13 changed files
with
177 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## TechStack | ||
|
||
| 카테고리 | 기술 | | ||
| --- | --- | | ||
| Language, Framework | Java, Spring Boot | | ||
| Database | MySQL, Redis, Flyway | | ||
| ORM | Spring Data JPA, QueryDSL | | ||
| 운영 환경 구축 | ECR, ECS, EC2, Docker | | ||
| Build | Gradle | | ||
| CI/CD | Github Actions | | ||
| library | Spring Open Feign, OAuth 2.0 | | ||
|
||
## docs | ||
[서브 도메인 적용하기](https://velog.io/@kssumin/%EC%84%9C%EB%B8%8C-%EB%8F%84%EB%A9%94%EC%9D%B8-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0) | ||
|
||
[타임존 설정](https://velog.io/@kssumin/DB%EC%97%90-%EB%93%A4%EC%96%B4%EA%B0%80%EB%8A%94-%EC%8B%9C%EA%B0%84%EC%9D%B4-%EC%9D%B4%EC%83%81%ED%95%98%EB%8B%A4) | ||
|
||
[분기 처리 코드 리팩터링하기](https://velog.io/@kssumin/%EB%B6%84%EA%B8%B0%EC%B2%98%EB%A6%AC-%EC%BD%94%EB%93%9C-%EB%A6%AC%ED%8C%A9%ED%84%B0%EB%A7%81-%ED%95%98%EA%B8%B0) | ||
|
||
[슬랙 API 호출 코드를 추상화하기](https://velog.io/@kssumin/%EC%8A%AC%EB%9E%99-API-%ED%98%B8%EC%B6%9C-%EC%BD%94%EB%93%9C%EB%A5%BC-%EC%B6%94%EC%83%81%ED%99%94%ED%95%98%EA%B8%B0) | ||
|
||
[200 status code만 사용하지 말자](https://velog.io/@kssumin/EEOS-%EC%BA%90%EC%8B%B1) | ||
|
||
## 실행방법 | ||
1. git clone | ||
2. 환경변수를 설정해줍니다.(env.properties) | ||
3. docker-compose를 통해 db를 실행합니다. | ||
4. spring boot를 실행합니다. |
22 changes: 22 additions & 0 deletions
22
BE/eeos/src/main/java/com/blackcompany/eeos/config/CacheWebConfig.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,22 @@ | ||
package com.blackcompany.eeos.config; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
import org.springframework.web.servlet.mvc.WebContentInterceptor; | ||
|
||
@Configuration | ||
public class CacheWebConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addInterceptors(final InterceptorRegistry registry) { | ||
CacheControl cacheControl = CacheControl.maxAge(60, TimeUnit.SECONDS); | ||
|
||
WebContentInterceptor interceptor = new WebContentInterceptor(); | ||
interceptor.addCacheMapping(cacheControl, "/api/**"); | ||
|
||
registry.addInterceptor(interceptor); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
BE/eeos/src/main/java/com/blackcompany/eeos/config/EtagConfig.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,18 @@ | ||
package com.blackcompany.eeos.config; | ||
|
||
import org.springframework.boot.web.servlet.FilterRegistrationBean; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.filter.ShallowEtagHeaderFilter; | ||
|
||
@Configuration | ||
public class EtagConfig { | ||
@Bean | ||
public FilterRegistrationBean<ShallowEtagHeaderFilter> shallowEtagHeaderFilter() { | ||
FilterRegistrationBean<ShallowEtagHeaderFilter> filterRegistrationBean = | ||
new FilterRegistrationBean<>(new ShallowEtagHeaderFilter()); | ||
filterRegistrationBean.addUrlPatterns("/api/*"); | ||
|
||
return filterRegistrationBean; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
...n/java/com/blackcompany/eeos/teamBuilding/application/event/DeletedTeamBuildingEvent.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,24 @@ | ||
package com.blackcompany.eeos.teamBuilding.application.event; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class DeletedTeamBuildingEvent { | ||
private final Long teamBuildingId; | ||
|
||
private DeletedTeamBuildingEvent(Long teamBuildingId) { | ||
this.teamBuildingId = teamBuildingId; | ||
} | ||
|
||
/** | ||
* 팀빌딩 삭제 이벤트를 생성한다. | ||
* | ||
* <p>이벤트 생성에서 예외가 발생하면 서비스 로직에 영향을 주므로 이벤트 리스너에서 핸들링을 할 때 예외 처리를 한다. | ||
* | ||
* @param teamBuildingId 삭제된 팀빌딩 정보 | ||
* @return | ||
*/ | ||
public static DeletedTeamBuildingEvent of(Long teamBuildingId) { | ||
return new DeletedTeamBuildingEvent(teamBuildingId); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...om/blackcompany/eeos/teamBuilding/application/event/DeletedTeamBuildingEventListener.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,29 @@ | ||
package com.blackcompany.eeos.teamBuilding.application.event; | ||
|
||
import com.blackcompany.eeos.target.persistence.TeamBuildingTargetRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Propagation; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import org.springframework.transaction.event.TransactionPhase; | ||
import org.springframework.transaction.event.TransactionalEventListener; | ||
import org.springframework.transaction.support.TransactionSynchronizationManager; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class DeletedTeamBuildingEventListener { | ||
private final TeamBuildingTargetRepository teamBuildingTargetRepository; | ||
|
||
@Async | ||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) | ||
@Transactional(propagation = Propagation.REQUIRES_NEW) | ||
public void handleDeletedTeamBuilding(DeletedTeamBuildingEvent event) { | ||
log.info( | ||
"팀빌딩 삭제 Transaction committed: {}", | ||
TransactionSynchronizationManager.isActualTransactionActive()); | ||
teamBuildingTargetRepository.deleteByTeamBuildingId(event.getTeamBuildingId()); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...ava/com/blackcompany/eeos/teamBuilding/application/usecase/DeleteTeamBuildingUsecase.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,10 @@ | ||
package com.blackcompany.eeos.teamBuilding.application.usecase; | ||
|
||
public interface DeleteTeamBuildingUsecase { | ||
/** | ||
* 팀빌딩 완료를 요청한다. | ||
* | ||
* @param memberId 팀빌딩 작성자 | ||
*/ | ||
void delete(Long memberId); | ||
} |
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