diff --git a/src/main/java/com/daon/onjung/event/application/service/ProcessCompletedEventService.java b/src/main/java/com/daon/onjung/event/application/service/ProcessCompletedEventService.java index 825e88f..f25b90c 100644 --- a/src/main/java/com/daon/onjung/event/application/service/ProcessCompletedEventService.java +++ b/src/main/java/com/daon/onjung/event/application/service/ProcessCompletedEventService.java @@ -93,8 +93,8 @@ public void execute(Long eventId) { applicationEventPublisher.publishEvent( scheduledEventJobService.createScheduledJob( newEvent.getId(), -// newEvent.getEndDate().plusDays(1).atStartOfDay() - LocalDateTime.now().plusMinutes(1) // 테스트용 1분 뒤 + newEvent.getEndDate().plusDays(1).atStartOfDay() +// LocalDateTime.now().plusMinutes(1) // 테스트용 1분 뒤 ) ); diff --git a/src/main/java/com/daon/onjung/security/application/service/SignUpOwnerByDefaultService.java b/src/main/java/com/daon/onjung/security/application/service/SignUpOwnerByDefaultService.java index 8cc56fe..2d1e78d 100644 --- a/src/main/java/com/daon/onjung/security/application/service/SignUpOwnerByDefaultService.java +++ b/src/main/java/com/daon/onjung/security/application/service/SignUpOwnerByDefaultService.java @@ -118,8 +118,8 @@ public void execute(MultipartFile logo, applicationEventPublisher.publishEvent( scheduledEventJobService.createScheduledJob( event.getId(), -// event.getEndDate().plusDays(1).atStartOfDay() - LocalDateTime.now().plusMinutes(1) // 테스트용 1분 뒤 + event.getEndDate().plusDays(1).atStartOfDay() +// LocalDateTime.now().plusMinutes(1) // 테스트용 1분 뒤 ) ); diff --git a/src/main/java/com/daon/onjung/suggestion/application/controller/command/SuggestionCommandV1Controller.java b/src/main/java/com/daon/onjung/suggestion/application/controller/command/SuggestionCommandV1Controller.java index 393648e..f61dab4 100644 --- a/src/main/java/com/daon/onjung/suggestion/application/controller/command/SuggestionCommandV1Controller.java +++ b/src/main/java/com/daon/onjung/suggestion/application/controller/command/SuggestionCommandV1Controller.java @@ -4,6 +4,7 @@ import com.daon.onjung.core.dto.ResponseDto; import com.daon.onjung.suggestion.application.dto.request.CreateBoardRequestDto; import com.daon.onjung.suggestion.application.dto.request.CreateCommentRequestDto; +import com.daon.onjung.suggestion.application.dto.response.CreateBoardResponseDto; import com.daon.onjung.suggestion.application.dto.response.CreateCommentResponseDto; import com.daon.onjung.suggestion.application.dto.response.CreateOrDeleteLikeResponseDto; import com.daon.onjung.suggestion.application.usecase.CreateBoardUseCase; @@ -26,13 +27,12 @@ public class SuggestionCommandV1Controller { private final CreateOrDeleteLikeUseCase createOrDeleteLikeUseCase; @PostMapping(value = "/api/v1/boards", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) - public ResponseDto createBoard( + public ResponseDto createBoard( @AccountID UUID accountId, @RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("body") @Valid CreateBoardRequestDto requestDto ) { - createBoardUseCase.execute(accountId, file, requestDto); - return ResponseDto.created(null); + return ResponseDto.created(createBoardUseCase.execute(accountId, file, requestDto)); } @PostMapping("/api/v1/boards/{id}/comments") diff --git a/src/main/java/com/daon/onjung/suggestion/application/dto/response/CreateBoardResponseDto.java b/src/main/java/com/daon/onjung/suggestion/application/dto/response/CreateBoardResponseDto.java new file mode 100644 index 0000000..34d1c3d --- /dev/null +++ b/src/main/java/com/daon/onjung/suggestion/application/dto/response/CreateBoardResponseDto.java @@ -0,0 +1,26 @@ +package com.daon.onjung.suggestion.application.dto.response; + +import com.daon.onjung.core.dto.SelfValidating; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Builder; +import lombok.Getter; + +@Getter +public class CreateBoardResponseDto extends SelfValidating { + + @JsonProperty("id") + private final Long id; + + @Builder + public CreateBoardResponseDto(Long id) { + this.id = id; + + this.validateSelf(); + } + + public static CreateBoardResponseDto of(Long id) { + return CreateBoardResponseDto.builder() + .id(id) + .build(); + } +} diff --git a/src/main/java/com/daon/onjung/suggestion/application/service/CreateBoardService.java b/src/main/java/com/daon/onjung/suggestion/application/service/CreateBoardService.java index fc407b5..c57590e 100644 --- a/src/main/java/com/daon/onjung/suggestion/application/service/CreateBoardService.java +++ b/src/main/java/com/daon/onjung/suggestion/application/service/CreateBoardService.java @@ -7,6 +7,7 @@ import com.daon.onjung.core.utility.S3Util; import com.daon.onjung.security.domain.type.EImageType; import com.daon.onjung.suggestion.application.dto.request.CreateBoardRequestDto; +import com.daon.onjung.suggestion.application.dto.response.CreateBoardResponseDto; import com.daon.onjung.suggestion.application.usecase.CreateBoardUseCase; import com.daon.onjung.suggestion.domain.Board; import com.daon.onjung.suggestion.domain.service.BoardService; @@ -31,7 +32,7 @@ public class CreateBoardService implements CreateBoardUseCase { @Override @Transactional - public void execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto) { + public CreateBoardResponseDto execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto) { // 유저 조회 User user = userRepository.findById(accountId) @@ -51,5 +52,7 @@ public void execute(UUID accountId, MultipartFile file, CreateBoardRequestDto re board = boardService.updateBoardFile(board, imgUrl); boardRepository.save(board); } + + return CreateBoardResponseDto.of(board.getId()); } } diff --git a/src/main/java/com/daon/onjung/suggestion/application/usecase/CreateBoardUseCase.java b/src/main/java/com/daon/onjung/suggestion/application/usecase/CreateBoardUseCase.java index e0d974f..d5264ac 100644 --- a/src/main/java/com/daon/onjung/suggestion/application/usecase/CreateBoardUseCase.java +++ b/src/main/java/com/daon/onjung/suggestion/application/usecase/CreateBoardUseCase.java @@ -2,6 +2,7 @@ import com.daon.onjung.core.annotation.bean.UseCase; import com.daon.onjung.suggestion.application.dto.request.CreateBoardRequestDto; +import com.daon.onjung.suggestion.application.dto.response.CreateBoardResponseDto; import org.springframework.web.multipart.MultipartFile; import java.util.UUID; @@ -9,5 +10,5 @@ @UseCase public interface CreateBoardUseCase { - void execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto); + CreateBoardResponseDto execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto); }