-
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.
Browse files
Browse the repository at this point in the history
feat: 이미지 s3 구현
- Loading branch information
Showing
12 changed files
with
285 additions
and
273 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
SCM/backend/src/main/java/error/pirate/backend/common/OctetStreamReadMsgConverter.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,34 @@ | ||
package error.pirate.backend.common; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
@Component | ||
public class OctetStreamReadMsgConverter extends AbstractJackson2HttpMessageConverter { | ||
@Autowired | ||
public OctetStreamReadMsgConverter(ObjectMapper objectMapper) { | ||
super(objectMapper, MediaType.APPLICATION_OCTET_STREAM); | ||
} | ||
|
||
// 기존 application/octet-stream 타입을 쓰기로 다루는 메시지 컨버터가 이미 존재 (ByteArrayHttpMessageConverter) | ||
// 따라서 해당 컨버터는 쓰기 작업에는 이용하면 안됨 | ||
@Override | ||
public boolean canWrite(Class<?> clazz, MediaType mediaType) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean canWrite(Type type, Class<?> clazz, MediaType mediaType) { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected boolean canWrite(MediaType mediaType) { | ||
return false; | ||
} | ||
} |
16 changes: 8 additions & 8 deletions
16
SCM/backend/src/main/java/error/pirate/backend/config/WebConfig.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,24 +1,24 @@ | ||
package error.pirate.backend.config; | ||
|
||
import error.pirate.backend.common.OctetStreamReadMsgConverter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.http.converter.HttpMessageConverter; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.util.List; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
private final Environment env; | ||
private final OctetStreamReadMsgConverter octetStreamReadMsgConverter; | ||
|
||
@Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/**") // 모든 경로에 대해 | ||
.allowedOrigins(env.getProperty("frontend")) // 허용할 출처 | ||
.allowedMethods("GET", "POST", "PUT", "PATCH", "DELETE") // 허용할 HTTP 메서드 | ||
.allowedHeaders("*") // 모든 헤더 허용 | ||
.exposedHeaders("Content-Disposition") | ||
.allowCredentials(true); // 자격 증명(쿠키 등) 허용 | ||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | ||
converters.add(octetStreamReadMsgConverter); | ||
} | ||
} |
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
32 changes: 0 additions & 32 deletions
32
SCM/backend/src/main/java/error/pirate/backend/item/command/application/dto/ItemDTO.java
This file was deleted.
Oops, something went wrong.
38 changes: 19 additions & 19 deletions
38
...nd/src/main/java/error/pirate/backend/item/command/application/dto/ItemUpdateRequest.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,24 +1,24 @@ | ||
package error.pirate.backend.item.command.application.dto; | ||
package error.pirate.backend.item.command.application.dto; | ||
|
||
import error.pirate.backend.item.command.domain.aggregate.entity.ItemDivision; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import error.pirate.backend.item.command.domain.aggregate.entity.ItemDivision; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Data | ||
public class ItemUpdateRequest { | ||
@Data | ||
public class ItemUpdateRequest { | ||
|
||
private Long itemUnitSeq; // 품목 단위 ID | ||
private String itemName; // 품목 이름 | ||
private ItemDivision itemDivision; // 품목 구분 | ||
private Integer itemExpirationHour; // 유통 기한 (시간) | ||
private String itemImageUrl; // 이미지 URL | ||
private Integer itemPrice; // 품목 가격 | ||
private String itemNote; // 품목 비고 | ||
private Long warehouseSeq; | ||
private Long itemUnitSeq; // 품목 단위 ID | ||
private Long warehouseSeq; | ||
private String itemName; // 품목 이름 | ||
private ItemDivision itemDivision; // 품목 구분 | ||
private Integer itemExpirationHour; // 유통 기한 (시간) | ||
private String itemImageUrl; // 이미지 URL | ||
private Integer itemPrice; // 품목 가격 | ||
private String itemNote; // 품목 비고 | ||
|
||
private List<BomItemDTO> bomItemList = new ArrayList<>(); // bom 품목 | ||
} | ||
private List<BomItemDTO> bomItemList = new ArrayList<>(); // bom 품목 | ||
} |
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
Oops, something went wrong.