-
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.
- Loading branch information
Showing
6 changed files
with
115 additions
and
18 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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/skhu/tastyinventory_be/controller/menu/MenuController.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,30 @@ | ||
package net.skhu.tastyinventory_be.controller.menu; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.skhu.tastyinventory_be.common.dto.BaseResponse; | ||
import net.skhu.tastyinventory_be.controller.menu.dto.request.MenuRequestDto; | ||
import net.skhu.tastyinventory_be.exception.SuccessCode; | ||
import net.skhu.tastyinventory_be.service.MenuService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RequestMapping("/menu") | ||
@RestController | ||
public class MenuController { | ||
private final MenuService menuService; | ||
|
||
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) | ||
@ResponseStatus(HttpStatus.CREATED) | ||
public BaseResponse<?> createMenu( | ||
@RequestPart("image") MultipartFile image, | ||
@RequestPart("data") MenuRequestDto requestDto | ||
) { | ||
menuService.createMenu(image, requestDto); | ||
return BaseResponse.success(SuccessCode.MENU_CREATE_SUCCESS); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/net/skhu/tastyinventory_be/controller/menu/dto/request/MenuRequestDto.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,18 @@ | ||
package net.skhu.tastyinventory_be.controller.menu.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MenuRequestDto { | ||
@NotBlank(message = "이름을 입력하세요.") | ||
private String name; | ||
|
||
private List<RelatedInventoryRequestDto> relatedInventory; | ||
} |
17 changes: 17 additions & 0 deletions
17
...va/net/skhu/tastyinventory_be/controller/menu/dto/request/RelatedInventoryRequestDto.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,17 @@ | ||
package net.skhu.tastyinventory_be.controller.menu.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class RelatedInventoryRequestDto { | ||
@NotNull(message = "재고 아이디를 입력하세요.") | ||
private Long inventoryId; | ||
|
||
@NotNull(message = "재고 사용량을 입력하세요.") | ||
private Long inventoryUsage; | ||
} |
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