forked from Fastcampus-Final-Team3/jober-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
공유페이지 멀티파트 파일 처리를 위한 저장 리팩토링 (Fastcampus-Final-Team3#203)
* feat : ApiStatus enum에 FILE_PROCESSING_NOT_SUPPORTED 필드 추가 (Fastcampus-Final-Team3#201) * feat : MoveBlockStrategy 인터페이스에 uploadFile 메서드 추가 (Fastcampus-Final-Team3#201) * refactor : FileBlockStrategy에 파일 업로드 기능 추가 및 파일 처리 로직 변경 (Fastcampus-Final-Team3#201) * refactor : FileBlockStrategy에서 currentFileName 필드를 AtomicReference로 변경 (Fastcampus-Final-Team3#201) - FileBlockStrategy 클래스에서 currentFileName 필드의 타입을 String에서 AtomicReference로 변경하였습니다. - 이는 동시성 문제를 해결하고자 함입니다. AtomicReference는 원자적 연산을 지원하여 여러 스레드에서 동시에 접근해도 안전하게 값을 변경하거나 가져올 수 있습니다. * feat : FixBlockStrategy 인터페이스에 uploadSingleFile, uploadTwoFiles 메서드 추가 (Fastcampus-Final-Team3#201) * feat : FixBlockStrategy 인터페이스에 saveStringBlocks 메서드 추가 (Fastcampus-Final-Team3#201) * refactor : StyleSettingStrategy 클래스에 단일 파일 업로드 기능 추가 및 base64 스타일 설정 저장 메서드 분리 (Fastcampus-Final-Team3#201) * refactor : WallInfoBlockStrategy 클래스에 여러 파일 업로드 기능 추가 및 base64 스타일 설정 저장 메서드 분리 (Fastcampus-Final-Team3#201) * refactor : MoveBlockStrategy 인터페이스에 saveStringBlocks 메서드 추가 (Fastcampus-Final-Team3#201) * refactor : base64 저장 메서드 분리 (Fastcampus-Final-Team3#201) * refactor : saveStringBlocks 메서드로 변경 (Fastcampus-Final-Team3#201) * refactor : FileUploadService save 메서드 로직 수정(Fastcampus-Final-Team3#201) * refactor : string에서 enum으로 변경 (Fastcampus-Final-Team3#201)
- Loading branch information
Showing
12 changed files
with
307 additions
and
83 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
18 changes: 17 additions & 1 deletion
18
src/main/java/com/javajober/spaceWall/strategy/FixBlockStrategy.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,16 +1,32 @@ | ||
package com.javajober.spaceWall.strategy; | ||
|
||
import static com.javajober.core.exception.ApiStatus.*; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.javajober.core.exception.ApplicationException; | ||
import com.javajober.core.util.response.CommonResponse; | ||
import com.javajober.spaceWall.dto.request.DataStringSaveRequest; | ||
import com.javajober.spaceWall.filedto.DataSaveRequest; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public interface FixBlockStrategy { | ||
void saveBlocks(final DataStringSaveRequest data, final ArrayNode blockInfoArray, final Long position); | ||
void saveStringBlocks(final DataStringSaveRequest data, final ArrayNode blockInfoArray, final Long position); | ||
|
||
void saveBlocks(final DataSaveRequest data, ArrayNode blockInfoArray, Long position); | ||
|
||
CommonResponse createFixBlockDTO(final List<JsonNode> fixBlocks); | ||
|
||
String getStrategyName(); | ||
|
||
default void uploadTwoFiles(final MultipartFile firstFile, final MultipartFile secondFile) { | ||
throw new ApplicationException(FILE_PROCESSING_NOT_SUPPORTED, "파일 처리를 지원하지 않습니다."); | ||
} | ||
|
||
default void uploadSingleFile(final MultipartFile singleFile) { | ||
throw new ApplicationException(FILE_PROCESSING_NOT_SUPPORTED, "파일 처리를 지원하지 않습니다."); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/javajober/spaceWall/strategy/MoveBlockStrategy.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,17 +1,29 @@ | ||
package com.javajober.spaceWall.strategy; | ||
|
||
import static com.javajober.core.exception.ApiStatus.*; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.javajober.core.exception.ApplicationException; | ||
import com.javajober.core.util.response.CommonResponse; | ||
import com.javajober.spaceWall.dto.request.BlockSaveRequest; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public interface MoveBlockStrategy { | ||
void saveStringBlocks(final BlockSaveRequest<?> block, final ArrayNode blockInfoArray, final Long position); | ||
|
||
void saveBlocks(final BlockSaveRequest<?> block, final ArrayNode blockInfoArray, final Long position); | ||
|
||
|
||
List<CommonResponse> createMoveBlockDTO(List<JsonNode> blocksWithSamePosition); | ||
|
||
String getStrategyName(); | ||
|
||
default void uploadFile(final MultipartFile file) { | ||
throw new ApplicationException(FILE_PROCESSING_NOT_SUPPORTED, "파일 처리를 지원하지 않습니다."); | ||
} | ||
} | ||
|
Oops, something went wrong.