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

카테고리 우선순위 저장 기능을 구현한다. #65

Merged
merged 8 commits into from
Jul 23, 2024

Conversation

JINU-CHANG
Copy link
Contributor

@JINU-CHANG JINU-CHANG commented Jul 23, 2024

❗ Issue

✨ 구현한 기능

  • 카테고리 우선순위 저장 기능 구현
  • 카테고리 우선순위 저장시 검증 메서드 구현
  • 테스트 코드 작성

📢 논의하고 싶은 내용

🎸 기타

  • 테스트용 application, schema, data 파일 추가했으니 확인해주세요.

@@ -18,6 +20,11 @@ public enum Category {
this.description = description;
}

public static boolean contains(Integer id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

int대신 Integer를 쓰신 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

int로 바꿨습니다! 타입이 int가 되려면 이전에 null check가 선행되어야 될 것 같은데
지금 당장 구현하기 힘들어서 TODO로 남겨두었어요.

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

@Repository
Copy link
Contributor

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.

와우 굿 😊

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

@Repository
Copy link
Contributor

Choose a reason for hiding this comment

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

여기도 확인해주세요!

Copy link
Contributor

@shin-jisong shin-jisong left a comment

Choose a reason for hiding this comment

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

간단한 코멘트 남깁니다!
완료 후 슬랙에 다시 태그 부탁드려요 ㅎㅎ

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

@Column(name = "category_id")
Copy link
Contributor

Choose a reason for hiding this comment

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

column 이름 설정의 규칙성을 모르겠어요!
코드를 작성하며 세운 이름 설정 규칙이 있다면 공유 가능할까요? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

해당 코드 필요없는 부분이어서 삭제했습니다. 이름 설정 규칙은 기본 규칙 그대로 적용하고 있어요.

private Long id;

@Column(name = "category_id")
private Integer categoryId;
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분은 왜 Integer가 되었나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

int타입이면 null값으로 들어왔을 때 0으로 저장되는데 이를 막고자 Integer타입으로 지정했습니다.
그리고 Entity에서는 래퍼타입으로 설정하기로 했었던 것 같아요!

@@ -0,0 +1,19 @@
CREATE TABLE users
Copy link
Contributor

Choose a reason for hiding this comment

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

schema.sql을 따로 작성해서 로딩 시 검증하는 방식으로 가는 건가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

저희가 작성한 스키마 타입으로 생성하는게 더 안전하다고 생각해서 schema 파일 추가했습니다.

@JINU-CHANG
Copy link
Contributor Author

코멘트 반영완료했습니다 확인해주세요 ☺️

Copy link
Contributor

@tkdgur0906 tkdgur0906 left a comment

Choose a reason for hiding this comment

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

확인했습니다!
고생하셨어요😃

@shin-jisong shin-jisong merged commit 2f1c2e4 into dev-be Jul 23, 2024
1 check passed
@shin-jisong shin-jisong deleted the feat/47-category-priority-api branch July 23, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants