- 
                Notifications
    You must be signed in to change notification settings 
- Fork 170
[4기 - 소재훈] SpringBoot Part2 Weekly Mission 제출합니다. #852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: jay-so
Are you sure you want to change the base?
Changes from all commits
5e0f655
              5f8b98f
              02dfa0f
              f1f9c5f
              10b60ad
              ce917df
              2ba1de8
              5c158a1
              0d6236e
              50faf9e
              b244133
              3561696
              65775ed
              7b6afd7
              fac02cf
              85a7f28
              b4d1d4d
              b253bc7
              64686ea
              eff8ead
              1388473
              a39864f
              b57abb4
              8184b01
              2881991
              e639fc4
              b6d9c82
              55a476b
              b78737c
              c6211fb
              24d66a4
              99261f6
              3c1325c
              d8a26dc
              65aa986
              708d122
              c5fbc8c
              3bcd69d
              c3ebd78
              7692e6e
              5b01135
              ca67652
              d2ec5ed
              f4cabf6
              f2b76ec
              9fe22df
              4850beb
              b8c3259
              3c52213
              8eb2131
              2f63b14
              adbe066
              00486b7
              be89fea
              610d29d
              32ef993
              32f5bc9
              78ae65a
              eb37421
              9f8cb2e
              efb2c17
              0ae3b88
              ef5f7fc
              80d6da6
              0a5b530
              782d1ff
              57fc4f8
              ef200db
              4f0e153
              efe50a5
              f9bbf30
              39c05b6
              62829f2
              a2819da
              2fc6c31
              0b3dddb
              242de2e
              823a26e
              4776765
              0cabf00
              7ecf182
              0408b1b
              ef16d6e
              5dbff20
              086aa43
              b367cff
              ed1dab1
              11c9919
              1e466a2
              7c26f43
              01850ce
              c40da75
              f5b3d23
              50d0a70
              fb882c6
              d862fb2
              a3a21db
              db6bae1
              b597e23
              fced138
              60d1d0a
              7c47aa9
              4a273f6
              42f649b
              1ee5042
              f662eed
              d7b413c
              c938213
              24b25fd
              6bee80e
              b591334
              59f070d
              59e4988
              14a424a
              324a8c5
              0a97825
              67c521e
              b5c9be8
              cd18193
              a68efd6
              8d01a64
              7f1413d
              417a24f
              8391d8d
              29c9377
              fd8fa6d
              1b36080
              8eed838
              aece849
              6e42178
              4b9625c
              cde2b26
              9540fc5
              77650eb
              3caf6f1
              3ba1020
              3e1fecc
              74c8884
              b614849
              ff3a646
              16c5564
              64a1afc
              bff8d3c
              5f1e161
              36ebafa
              377801a
              f6ec177
              92f7d04
              6df903a
              1ac32b0
              576c14b
              71a078a
              4df4706
              054e071
              0e1ac94
              1751735
              0173c56
              a588bfc
              523487f
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,56 +1,43 @@ | ||
| package com.prgrms.springbootbasic; | ||
|  | ||
| import com.prgrms.springbootbasic.controller.VoucherController; | ||
| import com.prgrms.springbootbasic.domain.Voucher; | ||
| import com.prgrms.springbootbasic.enums.Command; | ||
| import com.prgrms.springbootbasic.enums.VoucherType; | ||
| import com.prgrms.springbootbasic.enums.ConsoleMenu; | ||
| import com.prgrms.springbootbasic.view.Console; | ||
| import java.util.Map; | ||
| import java.util.UUID; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.boot.CommandLineRunner; | ||
| import org.springframework.context.annotation.Profile; | ||
| import org.springframework.stereotype.Component; | ||
|  | ||
| @Profile("!test") | ||
| @Slf4j | ||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class ConsoleApplication implements CommandLineRunner { | ||
|  | ||
| private final ConsoleVoucher consoleVoucher; | ||
| private final ConsoleCustomer consoleCustomer; | ||
| private final Console console; | ||
| private final VoucherController voucherController; | ||
|  | ||
| @Override | ||
| public void run(String... args) throws Exception { | ||
| console.consoleMenu(); | ||
|  | ||
| while (true) { | ||
| String command = console.inputCommand(); | ||
| Command inputCommand = Command.checkInputCommand(command); | ||
|  | ||
| switch (inputCommand) { | ||
| case CREATE -> createVoucher(); | ||
| case LIST -> getVoucherList(); | ||
| case EXIT -> { | ||
| console.printMessage("프로그램을 종료합니다."); | ||
| return; | ||
| console.printConsoleMenu(); | ||
| try { | ||
| ConsoleMenu inputMenu = ConsoleMenu.of(console.inputCommand()); | ||
|  | ||
| switch (inputMenu) { | ||
| case CUSTOMER -> consoleCustomer.menu(); | ||
| case VOUCHER -> consoleVoucher.menu(); | ||
| case EXIT -> { | ||
| console.printExitMessage(); | ||
| return; | ||
| } | ||
| } | ||
| } catch (IllegalArgumentException e) { | ||
| log.error("명령어가 잘못 입력되었습니다.", e.getMessage()); | ||
| } catch (Exception e) { | ||
| log.error("프로그램에서 오류가 발생하였습니다.", e.getMessage()); | ||
| } | ||
| } | ||
| } | ||
|  | ||
| private void createVoucher() { | ||
| String voucherTypeInput = console.inputVoucherType(); | ||
| VoucherType voucherType = VoucherType.checkVoucherType(voucherTypeInput); | ||
|  | ||
| long voucherDiscount = console.inputVoucherDiscount(); | ||
|  | ||
| voucherController.createVoucher(voucherType, voucherDiscount); | ||
| console.printMessage("바우처가 생성되었습니다!"); | ||
| } | ||
|  | ||
| private void getVoucherList() { | ||
| Map<UUID, Voucher> voucherMap = voucherController.printVoucherList(); | ||
| console.printlnVoucherList(voucherMap); | ||
| } | ||
| } | 
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,128 @@ | ||||||||||||||||||||||
| package com.prgrms.springbootbasic; | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.controller.customer.CustomerController; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.dto.customer.request.CustomerCreateRequest; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.dto.customer.request.CustomerUpdateRequest; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.dto.customer.response.CustomerListResponse; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.dto.customer.response.CustomerResponse; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.enums.customer.CustomerDeleteMenu; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.enums.customer.CustomerMenu; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.enums.customer.CustomerSelectMenu; | ||||||||||||||||||||||
| import com.prgrms.springbootbasic.view.Console; | ||||||||||||||||||||||
| import java.util.UUID; | ||||||||||||||||||||||
| import lombok.RequiredArgsConstructor; | ||||||||||||||||||||||
| import lombok.extern.slf4j.Slf4j; | ||||||||||||||||||||||
| import org.springframework.stereotype.Component; | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| @Slf4j | ||||||||||||||||||||||
| @Component | ||||||||||||||||||||||
| @RequiredArgsConstructor | ||||||||||||||||||||||
| public class ConsoleCustomer { | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| private final CustomerController customerController; | ||||||||||||||||||||||
| private final Console console; | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| public void menu() { | ||||||||||||||||||||||
| console.printCustomerMenu(); | ||||||||||||||||||||||
| switch (CustomerMenu.of(console.inputCommand())) { | ||||||||||||||||||||||
| case CREATE -> createCustomer(); | ||||||||||||||||||||||
| case UPDATE -> updateCustomer(); | ||||||||||||||||||||||
| case SELECT -> selectCustomer(); | ||||||||||||||||||||||
| case DELETE -> deleteCustomer(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| //생성(Create) | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| private void createCustomer() { | ||||||||||||||||||||||
| console.printCustomerCreateMenu(); | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| CustomerCreateRequest createRequest = console.inputCustomerCreateMessage(); | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| customerController.create(createRequest); | ||||||||||||||||||||||
| console.printCompleteMessage(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| //변경 | ||||||||||||||||||||||
| private void updateCustomer() { | ||||||||||||||||||||||
| console.printCustomerUpdateByID(); | ||||||||||||||||||||||
| UUID customerId = console.inputUUID(); | ||||||||||||||||||||||
| CustomerUpdateRequest updateRequest = console.inputCustomerUpdateMessage(customerId); | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| customerController.update(updateRequest); | ||||||||||||||||||||||
| console.printCompleteMessage(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| private void selectCustomer() { | ||||||||||||||||||||||
| console.printCustomerSelectMenu(); | ||||||||||||||||||||||
| //선택 - Id, CreateAt, All | ||||||||||||||||||||||
| switch (CustomerSelectMenu.of(console.inputCommand())) { | ||||||||||||||||||||||
| case ID -> { | ||||||||||||||||||||||
| console.printCustomerSelectById(); | ||||||||||||||||||||||
| UUID customerId = console.inputUUID(); | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| if (!customerController.checkCustomerId(customerId)) { | ||||||||||||||||||||||
| console.printErrorMessage("해당 ID를 가진 고객을 찾을 수 없습니다."); | ||||||||||||||||||||||
| } else { | ||||||||||||||||||||||
| 
      Comment on lines
    
      +65
     to 
      +67
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기서 먼저 체크하지 않아도 service 계층의 findById 메소드에서 값을 찾을 수 없는 경우 exception을 throw해주면 될것 같네요 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. service쪽 다시 보니까 excpetion을 던져주고 있네요. check 부분은 필요 없을것 같습니다. | ||||||||||||||||||||||
| CustomerResponse customerResponse = customerController.findById(customerId); | ||||||||||||||||||||||
| System.out.println("해당 고객의 ID: " + customerResponse.getCustomerId()); | ||||||||||||||||||||||
| System.out.println("해당 고객의 이름: " + customerResponse.getCustomerName()); | ||||||||||||||||||||||
| System.out.println("해당 고객의 이메일: " + customerResponse.getCustomerEmail()); | ||||||||||||||||||||||
| System.out.println("해당 고객의 생성일: " + customerResponse.getCreateAt()); | ||||||||||||||||||||||
|         
                  hanjo8813 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| //생성일 순으로 조회 - 오류 | ||||||||||||||||||||||
| case CREATEDAT -> { | ||||||||||||||||||||||
| console.printCutomerSelectByCreatedAt(); | ||||||||||||||||||||||
| CustomerListResponse customerListResponse = customerController.findByCreateAt(); | ||||||||||||||||||||||
| if (!customerListResponse.getCustomerResponseList().isEmpty()) { | ||||||||||||||||||||||
| console.printCustomerSelectByCreatedAt(customerListResponse); | ||||||||||||||||||||||
| } else { | ||||||||||||||||||||||
| console.printErrorMessage("현재 저장된 고객이 존재하지 않습니다."); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| 
      Comment on lines
    
      +79
     to 
      +83
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. early return을 사용해보는건 어떨까요? 
        Suggested change
       
 | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| //모든 리스트 조회 | ||||||||||||||||||||||
| case ALL -> { | ||||||||||||||||||||||
| CustomerListResponse customerListResponse = customerController.findAllList(); | ||||||||||||||||||||||
| if (!customerListResponse.getCustomerResponseList().isEmpty()) { | ||||||||||||||||||||||
| console.printCustomerSelectAll(customerListResponse); | ||||||||||||||||||||||
| } else { | ||||||||||||||||||||||
| console.printErrorMessage("현재 저장된 고객이 없습니다."); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| 
      Comment on lines
    
      +88
     to 
      +92
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 위 리뷰처럼 더 간결하게 바꿔주세요~ | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| default -> console.printErrorMessage("잘못된 Customer SelectMenu를 선택하셨습니다. 다시 확인해주세요."); | ||||||||||||||||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기서 로깅 빼먹으신것 같습니다~ | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| private void deleteCustomer() { | ||||||||||||||||||||||
| console.printCustomerDeleteMenu(); | ||||||||||||||||||||||
| //선택 - id, all | ||||||||||||||||||||||
| switch (CustomerDeleteMenu.of(console.inputCommand())) { | ||||||||||||||||||||||
| case ID -> { | ||||||||||||||||||||||
| console.printCustomerDeleteByID(); | ||||||||||||||||||||||
| UUID customerId = console.inputUUID(); | ||||||||||||||||||||||
|  | ||||||||||||||||||||||
| if (!customerController.checkCustomerId(customerId)) { | ||||||||||||||||||||||
| console.printErrorMessage(customerId + "찾을 고객이 존재하지 않습니다."); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| if (customerController.deleteById(customerId) == 0) { | ||||||||||||||||||||||
| console.printErrorMessage(customerId + " 삭제하려는 고객이 저장되어있지 않아 삭제할 수 없습니다."); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| 
      Comment on lines
    
      +107
     to 
      +114
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 두 로직이 같은 결과를 나타내고 있어서 함께 있을 필요가 없을것 같습니다. 그리고 해당 동작은 service 계층의 deleteById 메소드에서 수행하는게 좋을것 같습니다. 
 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 서비스쪽 다시 보고 오니 deleteById 메소드에 이미 체크를 수행하고 있네요. | ||||||||||||||||||||||
| console.printCompleteMessage(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| case ALL -> { | ||||||||||||||||||||||
| console.printCustomerDeleteByAll(); | ||||||||||||||||||||||
| customerController.deleteAll(); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| default -> { | ||||||||||||||||||||||
| IllegalStateException e = new IllegalStateException("프로그램 삭제 명령어 오류"); | ||||||||||||||||||||||
| log.error("프로그램 삭제 명령어 오류", e); | ||||||||||||||||||||||
| throw e; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| 
      Comment on lines
    
      +121
     to 
      +125
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기서 로깅을 한번 한 후 다시 exception throw하면 ConsoleApplication에서 또 해당 예외를 catch해서 로그가 두번 찍히지 않을까요? 이전 PR 리뷰 피드백이 잘 이뤄지지 않았네요. 그리고 exception을 생성하는 모든 곳에서 메시지에 정확한 예외 원인을 담아주셔야합니다. (어떤 입력값이 예외를 발생시켰는지) | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| package com.prgrms.springbootbasic; | ||
|  | ||
| import com.prgrms.springbootbasic.controller.voucher.VoucherController; | ||
| import com.prgrms.springbootbasic.dto.voucher.request.VoucherCreateRequest; | ||
| import com.prgrms.springbootbasic.dto.voucher.request.VoucherUpdateRequest; | ||
| import com.prgrms.springbootbasic.dto.voucher.response.VoucherListResponse; | ||
| import com.prgrms.springbootbasic.dto.voucher.response.VoucherResponse; | ||
| import com.prgrms.springbootbasic.enums.voucher.VoucherDeleteMenu; | ||
| import com.prgrms.springbootbasic.enums.voucher.VoucherMenu; | ||
| import com.prgrms.springbootbasic.enums.voucher.VoucherSelectMenu; | ||
| import com.prgrms.springbootbasic.enums.voucher.VoucherType; | ||
| import com.prgrms.springbootbasic.view.Console; | ||
| import java.util.UUID; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Component; | ||
|  | ||
| @Slf4j | ||
| @Component | ||
| @RequiredArgsConstructor | ||
| public class ConsoleVoucher { | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ConsoleCustomer와 중복되는 리뷰는 생략했습니다. | ||
|  | ||
| private final VoucherController voucherController; | ||
| private final Console console; | ||
|  | ||
| public void menu() { | ||
| console.printVoucherMenu(); | ||
|  | ||
| switch (VoucherMenu.of(console.inputCommand())) { | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 변수로 빼주세요! (가독성) | ||
| case CREATE -> createVoucher(); | ||
| case UPDATE -> updateVoucher(); | ||
| case SELECT -> selectVoucher(); | ||
| case DELETE -> deleteVoucher(); | ||
| } | ||
| } | ||
|  | ||
|  | ||
| //생성(Create) | ||
| private void createVoucher() { | ||
| console.printVoucherCreateTypeMenu(); | ||
| VoucherType type = VoucherType.of(console.inputCommand()); | ||
|  | ||
| console.printVoucherCreateDiscountMenu(); | ||
| VoucherCreateRequest createRequest = console.inputVoucherCreateMessage(type); | ||
|  | ||
| voucherController.create(createRequest); | ||
| console.printCompleteMessage(); | ||
| } | ||
|  | ||
| //변경(Update) | ||
| private void updateVoucher() { | ||
| console.printVoucherUpdateMenu(); | ||
| console.printVoucherUpdateById(); | ||
| UUID voucherId = console.inputUUID(); | ||
| VoucherUpdateRequest updateRequest = console.inputVoucherUpdateMessage(voucherId); | ||
|  | ||
| voucherController.update(updateRequest); | ||
| System.out.println("변경 후 금액 : " + updateRequest.getDiscount()); | ||
| console.printCompleteMessage(); | ||
| 
      Comment on lines
    
      +58
     to 
      +59
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 출력 책임은 console 객체에!! | ||
| } | ||
|  | ||
|  | ||
| //읽기(Read) - 모든 바우처를 조회하려면 All,타입별로 조회를 하려면 Type, ID로 조회하려면 ID, 생성일별로 조회하려면 CreateAt을 입력 | ||
| private void selectVoucher() { | ||
| console.printVoucherSelectMenu(); | ||
| //선택 - Id, Type, CreateAt, All | ||
| switch (VoucherSelectMenu.of(console.inputCommand())) { | ||
| case ID -> { | ||
| console.printVoucherSelectById(); | ||
| UUID voucherId = console.inputUUID(); | ||
|  | ||
| if (!voucherController.checkVoucherId(voucherId)) { | ||
| console.printErrorMessage("해당 ID를 가진 Voucher를 찾을 수 없습니다."); | ||
| } else { | ||
| VoucherResponse voucherResponse = voucherController.findById(voucherId); | ||
| System.out.println("해당 바우처의 ID: " + voucherResponse.getVoucherId()); | ||
| System.out.println("해당 바우처의 금액: " + voucherResponse.getDiscount()); | ||
| System.out.println("해당 바우처의 타입: " + voucherResponse.getType()); | ||
| System.out.println("해당 바우처의 생성일:" + voucherResponse.getCreateAt()); | ||
| } | ||
| } | ||
| //바우처 타입 | ||
| case TYPE -> { | ||
| console.printVoucherSelectByType(); | ||
| VoucherType voucherType = VoucherType.of(console.inputCommand()); | ||
| VoucherListResponse vouchersByType = voucherController.findByType(voucherType); | ||
| if (!vouchersByType.getVoucherResponseList().isEmpty()) { | ||
| console.printVoucherSelectByTypeList(vouchersByType); | ||
| } else { | ||
| console.printErrorMessage("해당 타입의 바우처가 존재하지 않습니다."); | ||
| } | ||
| } | ||
| //생성일 순으로 조회 | ||
| case CREATEDAT -> { | ||
| VoucherListResponse voucherListResponse = voucherController.findByCreatedAt(); | ||
| if (!voucherListResponse.getVoucherResponseList().isEmpty()) { | ||
| console.printVoucherSelectByCreateAt(voucherListResponse); | ||
| } else { | ||
| console.printErrorMessage("현재 저장된 바우처가 존재하지 않습니다."); | ||
| } | ||
| if (!voucherListResponse.getVoucherResponseList().isEmpty()) { | ||
| console.printVoucherSelectBYAll(voucherListResponse); | ||
| } else { | ||
|  | ||
| } | ||
|  | ||
| 
      Comment on lines
    
      +103
     to 
      +106
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코드 삭제 까먹으신것 같아요~ | ||
| } | ||
| //모든 리스트 조회 | ||
| case ALL -> { | ||
| VoucherListResponse voucherListResponse = voucherController.findAllList(); | ||
| if (!voucherListResponse.getVoucherResponseList().isEmpty()) { | ||
| console.printVoucherSelectBYAll(voucherListResponse); | ||
| } else { | ||
| console.printErrorMessage("현재 저장된 바우처가 없습니다."); | ||
| } | ||
| } | ||
| default -> console.printErrorMessage("잘못된 voucherSelectMenu를 선택하셨습니다. 다시 확인해주세요."); | ||
| } | ||
| } | ||
|  | ||
| //삭제(DELET)- id, all | ||
| private void deleteVoucher() { | ||
| console.printVoucherDeleteMenu(); | ||
| //선택 - id, all | ||
| switch (VoucherDeleteMenu.of(console.inputCommand())) { | ||
| case ID -> { | ||
| console.printVoucherDeleteById(); | ||
| UUID voucherId = console.inputUUID(); | ||
|  | ||
| if (voucherController.deleteById(voucherId) == 0) { | ||
| console.printErrorMessage(voucherId + " 삭제하려는 바우처가 저장되어있지 않아 삭제할 수 없습니다."); | ||
| return; | ||
| } | ||
| console.printCompleteMessage(); | ||
| } | ||
| case ALL -> { | ||
| console.printVoucherDeleteAll(); | ||
| voucherController.deleteAll(); | ||
| console.printCompleteMessage(); | ||
| } | ||
| default -> { | ||
| IllegalStateException e = new IllegalStateException("프로그램 삭제 명령어 오류"); | ||
| log.error("프로그램 삭제 명령어 오류", e); | ||
| throw e; | ||
| } | ||
| } | ||
| } | ||
| 
      Comment on lines
    
      +121
     to 
      +147
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기도 customer 쪽 리뷰 참고해서 리팩토링해주세요~ | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정확히 어떤걸 의미하는지 나타내기 위해 이름을 가진 변수로 빼주는게 좋을것 같아요~