Skip to content

Commit

Permalink
πŸ”¨ Refactor/#179 - κ²Œμ‹œκΈ€ 생성 μ‹œ μƒμ„±λœ κ²Œμ‹œκΈ€ id ν•¨κ»˜ λ°˜ν™˜
Browse files Browse the repository at this point in the history
  • Loading branch information
dongkyeomjang committed Nov 27, 2024
1 parent 97890ff commit d08ff64
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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λΆ„ λ’€
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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λΆ„ λ’€
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Void> createBoard(
public ResponseDto<CreateBoardResponseDto> 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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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<CreateBoardResponseDto> {

@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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

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;

@UseCase
public interface CreateBoardUseCase {

void execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto);
CreateBoardResponseDto execute(UUID accountId, MultipartFile file, CreateBoardRequestDto requestDto);
}

0 comments on commit d08ff64

Please sign in to comment.