-
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.
Merge branch 'main' into yongwook_schedule
- Loading branch information
Showing
28 changed files
with
723 additions
and
16 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
26 changes: 26 additions & 0 deletions
26
...java/net/skhu/tastyinventory_be/controller/inventoryRecord/InventoryRecordController.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,26 @@ | ||
package net.skhu.tastyinventory_be.controller.inventoryRecord; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.skhu.tastyinventory_be.common.dto.BaseResponse; | ||
import net.skhu.tastyinventory_be.controller.inventoryRecord.dto.request.InventoryRecordRequestDto; | ||
import net.skhu.tastyinventory_be.exception.SuccessCode; | ||
import net.skhu.tastyinventory_be.service.InventoryRecordService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RequestMapping("/inventory-records") | ||
@RestController | ||
public class InventoryRecordController { | ||
private final InventoryRecordService inventoryRecordService; | ||
|
||
@PostMapping | ||
@ResponseStatus(HttpStatus.CREATED) | ||
public BaseResponse<?> createRecord(@RequestBody @Valid InventoryRecordRequestDto requestDto) { | ||
inventoryRecordService.createInventoryRecord(requestDto); | ||
return BaseResponse.success(SuccessCode.INVENTORY_RECORD_CREATE_SUCCESS); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...net/skhu/tastyinventory_be/controller/inventoryRecord/dto/request/InventoryRecordDto.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,20 @@ | ||
package net.skhu.tastyinventory_be.controller.inventoryRecord.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class InventoryRecordDto { | ||
@NotNull(message = "μ¬κ³ μμ΄λλ₯Ό μ λ ₯νμΈμ") | ||
private Long inventoryId; | ||
|
||
@NotNull(message = "ν μ¬κ³ λμ μ λ ₯νμΈμ") | ||
private Long currentVolume; | ||
|
||
@NotNull(message = "λ°μ£Όλμ μ λ ₯νμΈμ") | ||
private Long orderVolume; | ||
} |
23 changes: 23 additions & 0 deletions
23
...u/tastyinventory_be/controller/inventoryRecord/dto/request/InventoryRecordRequestDto.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,23 @@ | ||
package net.skhu.tastyinventory_be.controller.inventoryRecord.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Pattern; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class InventoryRecordRequestDto { | ||
@NotBlank(message = "λ μ§λ₯Ό μ λ ₯νμΈμ") | ||
@Pattern( | ||
regexp="^\\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$", | ||
message = "YYYY-MM-DD νμμΌλ‘ μ λ ₯νμΈμ" | ||
) | ||
private String date; | ||
|
||
private List<InventoryRecordDto> inventoryRecords; | ||
} |
70 changes: 70 additions & 0 deletions
70
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,70 @@ | ||
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.controller.menu.dto.response.MenuDetailResponseDto; | ||
import net.skhu.tastyinventory_be.controller.menu.dto.response.MenuResponseDto; | ||
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; | ||
|
||
import java.util.List; | ||
|
||
@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); | ||
} | ||
|
||
@GetMapping | ||
@ResponseStatus(HttpStatus.OK) | ||
public BaseResponse<List<MenuResponseDto>> findAll() { | ||
final List<MenuResponseDto> data = menuService.findAllMenu(); | ||
return BaseResponse.success(SuccessCode.GET_SUCCESS, data); | ||
} | ||
|
||
@GetMapping("/{id}") | ||
@ResponseStatus(HttpStatus.OK) | ||
public BaseResponse<MenuDetailResponseDto> findOne(@PathVariable Long id) { | ||
final MenuDetailResponseDto data = menuService.findOneMenu(id); | ||
return BaseResponse.success(SuccessCode.GET_SUCCESS, data); | ||
} | ||
|
||
@PatchMapping( | ||
consumes = MediaType.MULTIPART_FORM_DATA_VALUE, | ||
produces = MediaType.APPLICATION_JSON_VALUE, | ||
path = "/{id}" | ||
) | ||
@ResponseStatus(HttpStatus.OK) | ||
public BaseResponse<?> updateMenu( | ||
@RequestPart("image") MultipartFile image, | ||
@RequestPart("data") MenuRequestDto requestDto, | ||
@PathVariable Long id | ||
) { | ||
menuService.updateMenu(id, image, requestDto); | ||
return BaseResponse.success(SuccessCode.MENU_PATCH_SUCCESS); | ||
} | ||
|
||
@DeleteMapping("/{id}") | ||
@ResponseStatus(HttpStatus.OK) | ||
public BaseResponse<?> deleteMenu(@PathVariable Long id) { | ||
menuService.deleteMenu(id); | ||
return BaseResponse.success(SuccessCode.MENU_DELETE_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> relatedInventories; | ||
} |
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; | ||
} |
33 changes: 33 additions & 0 deletions
33
...n/java/net/skhu/tastyinventory_be/controller/menu/dto/response/MenuDetailResponseDto.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,33 @@ | ||
package net.skhu.tastyinventory_be.controller.menu.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class MenuDetailResponseDto{ | ||
Long menuId; | ||
String menuName; | ||
String menuImage; | ||
List<RelatedInventoryResponseDto> relatedInventories; | ||
|
||
public static MenuDetailResponseDto of( | ||
Long menuId, | ||
String menuName, | ||
String menuImage, | ||
List<RelatedInventoryResponseDto> relatedInventories | ||
) { | ||
return new MenuDetailResponseDto( | ||
menuId, | ||
menuName, | ||
menuImage, | ||
relatedInventories | ||
); | ||
} | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
src/main/java/net/skhu/tastyinventory_be/controller/menu/dto/response/MenuResponseDto.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,19 @@ | ||
package net.skhu.tastyinventory_be.controller.menu.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class MenuResponseDto{ | ||
Long menuId; | ||
String menuName; | ||
String menuImage; | ||
|
||
public static MenuResponseDto of(Long menuId, String menuName, String menuImage) { | ||
return new MenuResponseDto(menuId, menuName, menuImage); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
.../net/skhu/tastyinventory_be/controller/menu/dto/response/RelatedInventoryResponseDto.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,31 @@ | ||
package net.skhu.tastyinventory_be.controller.menu.dto.response; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import net.skhu.tastyinventory_be.domain.inventory.Unit; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class RelatedInventoryResponseDto { | ||
Long inventoryId; | ||
String inventoryName; | ||
Long inventoryUsage; | ||
Unit inventoryUnit; | ||
|
||
public static RelatedInventoryResponseDto of( | ||
Long inventoryId, | ||
String inventoryName, | ||
Long inventoryUsage, | ||
Unit inventoryUnit | ||
) { | ||
return new RelatedInventoryResponseDto( | ||
inventoryId, | ||
inventoryName, | ||
inventoryUsage, | ||
inventoryUnit | ||
); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/net/skhu/tastyinventory_be/controller/sold/SoldController.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,26 @@ | ||
package net.skhu.tastyinventory_be.controller.sold; | ||
|
||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import net.skhu.tastyinventory_be.common.dto.BaseResponse; | ||
import net.skhu.tastyinventory_be.controller.sold.dto.request.SoldRequestDto; | ||
import net.skhu.tastyinventory_be.exception.SuccessCode; | ||
import net.skhu.tastyinventory_be.service.SoldService; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@RequestMapping("/sold") | ||
@RestController | ||
public class SoldController { | ||
private final SoldService soldService; | ||
|
||
@PostMapping | ||
@ResponseStatus(HttpStatus.CREATED) | ||
public BaseResponse<?> registerSold(@RequestBody @Valid SoldRequestDto requestDto) { | ||
soldService.registerSold(requestDto); | ||
return BaseResponse.success(SuccessCode.SOLD_CREATE_SUCCESS); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/net/skhu/tastyinventory_be/controller/sold/dto/request/SoldMenuDto.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.sold.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SoldMenuDto { | ||
@NotNull(message = "λ©λ΄ μμ΄λλ₯Ό μ λ ₯νμΈμ") | ||
private Long menuId; | ||
|
||
@NotNull(message = "λ©λ΄ ν맀 μλμ μ λ ₯νμΈμ") | ||
private Long soldCount; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/net/skhu/tastyinventory_be/controller/sold/dto/request/SoldRequestDto.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,23 @@ | ||
package net.skhu.tastyinventory_be.controller.sold.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Pattern; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class SoldRequestDto { | ||
@NotBlank(message = "λ μ§λ₯Ό μ λ ₯νμΈμ") | ||
@Pattern( | ||
regexp="^\\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$", | ||
message = "YYYY-MM-DD νμμΌλ‘ μ λ ₯νμΈμ" | ||
) | ||
private String date; | ||
|
||
private List<SoldMenuDto> soldMenuList; | ||
} |
Oops, something went wrong.