-
Notifications
You must be signed in to change notification settings - Fork 1
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: 반찬 생성, 수정 삭제 api 이미지 추가 * feat: 반찬 조회 api 이미지 추가 * refactor: 반찬 이미지 관련 코드 리팩토링 * feat: 반찬 품절여부 enum, 수량 추가 * remove: 도시락 생성 시 반찬 품절여부 검증 제거 * chore: spotless 적용
- Loading branch information
Showing
52 changed files
with
778 additions
and
174 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
23 changes: 15 additions & 8 deletions
23
...on/app-api/src/main/java/core/startup/mealtoktok/api/dishstore/response/DishResponse.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,24 @@ | ||
package core.startup.mealtoktok.api.dishstore.response; | ||
|
||
import core.startup.mealtoktok.common.dto.Money; | ||
import core.startup.mealtoktok.domain.dishstore.Dish; | ||
import core.startup.mealtoktok.domain.dishstore.DishAndImage; | ||
import core.startup.mealtoktok.domain.dishstore.DishState; | ||
|
||
public record DishResponse( | ||
Long dishId, String dishName, Money dishPrice, String imgUrl, boolean isSoldOut) { | ||
Long dishId, | ||
String dishName, | ||
Money dishPrice, | ||
String imgUrl, | ||
int dishQuantity, | ||
DishState dishState) { | ||
|
||
public static DishResponse from(Dish dish) { | ||
public static DishResponse from(DishAndImage dishAndImage) { | ||
return new DishResponse( | ||
dish.getDishId(), | ||
dish.getDishName(), | ||
dish.getDishPrice(), | ||
dish.getImgUrl(), | ||
dish.isSoldOut()); | ||
dishAndImage.dish().getDishId(), | ||
dishAndImage.dish().getDishName(), | ||
dishAndImage.dish().getDishPrice(), | ||
dishAndImage.image().getImageUrl(), | ||
dishAndImage.dish().getDishQuantity(), | ||
dishAndImage.dish().getDishState()); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...java/core/startup/mealtoktok/api/global/config/MultipartJackson2HttpMessageConverter.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,32 @@ | ||
package core.startup.mealtoktok.api.global.config; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
@Component | ||
public class MultipartJackson2HttpMessageConverter extends AbstractJackson2HttpMessageConverter { | ||
|
||
public MultipartJackson2HttpMessageConverter(ObjectMapper objectMapper) { | ||
super(objectMapper, MediaType.APPLICATION_OCTET_STREAM); | ||
} | ||
|
||
@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; | ||
} | ||
} |
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
2 changes: 2 additions & 0 deletions
2
common/src/main/java/core/startup/mealtoktok/common/dto/Image.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
20 changes: 0 additions & 20 deletions
20
domain/src/main/java/core/startup/mealtoktok/domain/dishstore/DeleteDishService.java
This file was deleted.
Oops, something went wrong.
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
9 changes: 9 additions & 0 deletions
9
domain/src/main/java/core/startup/mealtoktok/domain/dishstore/DishAndImage.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,9 @@ | ||
package core.startup.mealtoktok.domain.dishstore; | ||
|
||
import core.startup.mealtoktok.common.dto.Image; | ||
|
||
public record DishAndImage(Dish dish, Image image) { | ||
public static DishAndImage of(Dish dish, Image images) { | ||
return new DishAndImage(dish, images); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
domain/src/main/java/core/startup/mealtoktok/domain/dishstore/DishAndImageWrapper.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,27 @@ | ||
package core.startup.mealtoktok.domain.dishstore; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import core.startup.mealtoktok.common.dto.Image; | ||
import core.startup.mealtoktok.domain.global.ImageReader; | ||
import core.startup.mealtoktok.domain.global.TargetImage; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class DishAndImageWrapper { | ||
|
||
private final ImageReader imageReader; | ||
|
||
public DishAndImage wrap(Dish dish) { | ||
Image image = imageReader.read(TargetImage.from(dish.getDishImage().imageId())); | ||
return DishAndImage.of(dish, image); | ||
} | ||
|
||
public List<DishAndImage> wrapAll(List<Dish> dishes) { | ||
return dishes.stream().map(this::wrap).toList(); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
domain/src/main/java/core/startup/mealtoktok/domain/dishstore/DishImage.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,10 @@ | ||
package core.startup.mealtoktok.domain.dishstore; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record DishImage(Long dishId, Long imageId) { | ||
public static DishImage of(Long dishId, Long imageId) { | ||
return new DishImage(dishId, imageId); | ||
} | ||
} |
Oops, something went wrong.