Skip to content
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

GDSC Assignment04 - 안준영 #19

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Junyeong-An
Copy link

@Junyeong-An Junyeong-An commented Nov 6, 2023

Description

  • 상품 구매 CRUD
  • Customer CRUD

Important content

  • 연관관계 매핑이 어려운 것 같습니다.
  • 데이터베이스 설계할 때 기본키와 외래키 설정의 중요성을 알았습니다.

Question

  • 음.. 어찌 저찌 예제 코드를 참조하면서 작성했는데 사실 아직 잘 모르겠습니다. 좀 더 이해하고 작성할 수 있도록 해야 할 것 같습니다...😭
  • 너무 많음

Reference

예제 코드 및 구글링

Copy link
Member

@YehyeokBang YehyeokBang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳~~

ResponseEntity 배워서 적용해보면 좋을 것 같아요~

Copy link
Member

@YehyeokBang YehyeokBang Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URI 중복되는 부분 제거를 위해 @RequestMapping 사용하는 방법이 있습니다.

@RestController
@RequiredArgsConstructor
@RequestMapping("customer")
public class CustomerController {
    private final CustomerService customerService;

    @GetMapping("")
    public List<Customer> customerFindAll() {
        return customerService.customerList();
    }
    
    ...
    
}

Comment on lines +48 to +53
public void updateAge(Integer age) {
if(age<0){
throw new IllegalArgumentException("나이는 0보다 작을 수 없습니다.");
}
this.age = age;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

검증 로직으로 객체 스스로를 지키는 코드 괜찮네요.

Comment on lines +33 to +36
public Customer findCustomerById(Integer id) {
return customerRepository.findById(id).orElseThrow(()
-> new IllegalArgumentException("해당 고객ID가 없습니다."));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public Customer findCustomerById(Integer id) {
        return customerRepository.findById(id)
                        .orElseThrow(() -> new IllegalArgumentException("해당 고객ID가 없습니다."));
}

람다식 중간에 개행을 넣는 것 보단 .을 기반으로 개행을 추가하면 가독성이 더 좋아질 것 같습니다.

Copy link
Member

@YehyeokBang YehyeokBang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

자신의 이름으로 된 폴더 안에 넣어야 합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants