-
Notifications
You must be signed in to change notification settings - Fork 3
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 #72 from bandalgomsu/main
feat : 메일전송 비동기 처리
- Loading branch information
Showing
18 changed files
with
267 additions
and
186 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
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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/example/jolvre/common/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,30 @@ | ||
package com.example.jolvre.common.config; | ||
|
||
import java.util.concurrent.Executor; | ||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.AsyncConfigurer; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
|
||
@Configuration | ||
@EnableAsync | ||
public class AsyncConfig implements AsyncConfigurer { | ||
@Override | ||
@Bean | ||
public Executor getAsyncExecutor() { | ||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | ||
executor.setCorePoolSize(2); | ||
executor.setMaxPoolSize(5); | ||
executor.setQueueCapacity(10); | ||
executor.setThreadNamePrefix("Async MailExecutor-"); | ||
executor.initialize(); | ||
return executor; | ||
} | ||
|
||
@Override | ||
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { | ||
return AsyncConfigurer.super.getAsyncUncaughtExceptionHandler(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/example/jolvre/common/config/QueryDslConfig.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,19 @@ | ||
package com.example.jolvre.common.config; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import jakarta.persistence.EntityManager; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class QueryDslConfig { | ||
private final EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory jpaQueryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/example/jolvre/common/error/user/UserAlreadyExistException.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,11 @@ | ||
package com.example.jolvre.common.error.user; | ||
|
||
import com.example.jolvre.common.error.EntityNotFoundException; | ||
import com.example.jolvre.common.error.ErrorCode; | ||
|
||
public class UserAlreadyExistException extends EntityNotFoundException { | ||
|
||
public UserAlreadyExistException() { | ||
super(ErrorCode.USER_NOT_FOUND); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/com/example/jolvre/exhibition/api/ExhibitionCommentController.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,67 @@ | ||
package com.example.jolvre.exhibition.api; | ||
|
||
import com.example.jolvre.auth.PrincipalDetails; | ||
import com.example.jolvre.exhibition.dto.ExhibitDTO.ExhibitCommentInfoResponses; | ||
import com.example.jolvre.exhibition.dto.ExhibitDTO.ExhibitCommentUpdateRequest; | ||
import com.example.jolvre.exhibition.dto.ExhibitDTO.ExhibitCommentUploadRequest; | ||
import com.example.jolvre.exhibition.service.ExhibitCommentService; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
@RequestMapping("/api/v1/exhibit") | ||
public class ExhibitionCommentController { | ||
private final ExhibitCommentService exhibitCommentService; | ||
|
||
@Operation(summary = "해당 전시 코멘트 업로드", description = "해당 전시에 코멘트를 업로드 한다") | ||
@PostMapping("/{exhibitId}/comment") | ||
public ResponseEntity<Void> uploadComment(@PathVariable Long exhibitId, | ||
@AuthenticationPrincipal PrincipalDetails principalDetails, | ||
@RequestBody ExhibitCommentUploadRequest request) { | ||
exhibitCommentService.uploadComment(exhibitId, principalDetails.getId(), request); | ||
|
||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@Operation(summary = "해당 전시 모든 코멘트 조회", description = "해당 전시에 코멘트를 입력한다") | ||
@GetMapping("/{exhibitId}/comment") | ||
public ResponseEntity<ExhibitCommentInfoResponses> getAllComment(@PathVariable Long exhibitId) { | ||
ExhibitCommentInfoResponses response = exhibitCommentService.getAllCommentInfo(exhibitId); | ||
|
||
return ResponseEntity.ok().body(response); | ||
} | ||
|
||
@Operation(summary = "코멘트 수정", description = "해당 전시에 특정 코멘트를 수정한다") | ||
@PatchMapping("/{exhibitId}/comment/{commentId}") | ||
public ResponseEntity<Void> updateComment(@PathVariable Long exhibitId, | ||
@PathVariable Long commentId, | ||
@AuthenticationPrincipal PrincipalDetails principalDetails, | ||
@RequestBody ExhibitCommentUpdateRequest request) { | ||
exhibitCommentService.updateComment(commentId, principalDetails.getId(), request); | ||
|
||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@Operation(summary = "코멘트 삭제", description = "해당 전시에 특정 코멘트를 삭제한다") | ||
@DeleteMapping("/{exhibitId}/comment/{commentId}") | ||
public ResponseEntity<Void> deleteComment(@PathVariable Long exhibitId, | ||
@PathVariable Long commentId, | ||
@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
exhibitCommentService.deleteComment(commentId, principalDetails.getId()); | ||
|
||
return ResponseEntity.ok().build(); | ||
} | ||
} |
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
Oops, something went wrong.