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

✨ save categories of recipe #68

Merged
merged 9 commits into from
Jul 24, 2024
Merged

✨ save categories of recipe #68

merged 9 commits into from
Jul 24, 2024

Conversation

hyxrxn
Copy link
Contributor

@hyxrxn hyxrxn commented Jul 23, 2024

카테고리명을 List로 받아 각각의 String에 대해 저장 작업을 합니다.

카테고리 하나의 저장 과정은 다음과 같습니다.
먼저 그 String이 카테고리 테이블에 있는지 확인합니다.
있다면 그 카테고리를 가져오고, 없다면 String을 카테고리 테이블에 저장한 후 가져옵니다.
그리고 레시피-카테고리 중간 테이블에 저장합니다.

Copy link

Overall Project 88.16% 🍏
Files changed 100% 🍏

File Coverage
CategoryService.java 100% 🍏
Category.java 100% 🍏
CategoryRecipe.java 100% 🍏

public class Category {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;

private String name;

public Category(String name) {
this(0, name);

Choose a reason for hiding this comment

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

여러분 일관성을 위해 앞으로 둘중 하나로 통일하는건 어떤가요??

  • this(0, name);
  • this(0L, name);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

토의 결과대로 0L로 변경하도록 하겠습니다~


@Entity
@NoArgsConstructor

Choose a reason for hiding this comment

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

@NoArgsConstructor에 접근 지정자를 붙여줘도 좋을것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

그런 기능이 있었군요
좋은 생각입니다
추가하겠습니다~

Copy link
Contributor

@geoje geoje left a comment

Choose a reason for hiding this comment

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

테스트 커버리지도 좋고 전체적으로 코드가 짜임새 있게 작성된 것 같았습니다! 굿굿~


@DataJpaTest
@Import(CategoryService.class)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
Copy link
Contributor

@geoje geoje Jul 24, 2024

Choose a reason for hiding this comment

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

혹시 이 부분(23 line)은 무슨 의도 일까용?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

로키 테스트에서 긁어서 변경 후 사용했는데 저한테는 필요 없는 부분이 딸려왔네요
인메모리 db로도 충분한 테스트인 것 같습니다!

Copy link

Overall Project 88.16% 🍏
Files changed 100% 🍏

File Coverage
CategoryService.java 100% 🍏
Category.java 100% 🍏
CategoryRecipe.java 100% 🍏

Copy link

@oshyun00 oshyun00 left a comment

Choose a reason for hiding this comment

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

전체적으로 깔끔하네요. 궁금한부분 하나만 코멘트 남겨두었습니다. 고생많으셨어요!

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository

Choose a reason for hiding this comment

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

JpaRepository를 상속받고있어서 애너테이션을 제거해도 정상동작할것같은데요, 넣어두신 이유가 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JpaRepository면 Spring Data JPA가 알아서 구현체를 주입해주는군요!
처음 알았네요.
빈으로 등록이 안될 것이라 생각하고 붙였습니다.
수정하겠습니다~

Copy link

Overall Project 88.16% 🍏
Files changed 100% 🍏

File Coverage
CategoryService.java 100% 🍏
Category.java 100% 🍏
CategoryRecipe.java 100% 🍏

Copy link

Overall Project 88.16% 🍏
Files changed 100% 🍏

File Coverage
CategoryService.java 100% 🍏
Category.java 100% 🍏
CategoryRecipe.java 100% 🍏

Copy link

Overall Project 88.16% 🍏
Files changed 100% 🍏

File Coverage
CategoryService.java 100% 🍏
Category.java 100% 🍏
CategoryRecipe.java 100% 🍏

@hyxrxn hyxrxn merged commit 47acc95 into be/dev Jul 24, 2024
1 check passed
@hyxrxn hyxrxn deleted the be/feat/25 branch July 24, 2024 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE Backend ✨ feature new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants