-
Notifications
You must be signed in to change notification settings - Fork 4
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
사용자 가입 시 신뢰도를 null로 설정 #536
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
668ed15
feat: 사용자 신뢰도에 double 대신 Double을 사용하도록 수정
kwonyj1022 88de52f
feat: 판매자 신뢰도가 null인 경우 지정한 경매 아이디에 해당하는 경매 조회 시 정상적으로 동작하는지에 대한 테스트 추가
kwonyj1022 df6b52b
feat: 사용자 엔티티의 `@EqualsAndHashCode` 옵션에 `callSuper = false` 추가
kwonyj1022 47620bd
refactor: 사용하지 않는 dto 제거
kwonyj1022 1f66ba2
test: 실패하는 테스트 수정
kwonyj1022 8a84619
test: dto와 관련된 테스트를 dto 테스트 클래스로 이동
kwonyj1022 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
@EqualsAndHashCode(of = "id") | ||
@EqualsAndHashCode(of = "id", callSuper = false) | ||
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. 칭찬경고 억제 👍 |
||
@ToString(of = {"id", "name", "reliability", "oauthId", "deleted"}) | ||
@Table(name = "users") | ||
public class User extends BaseTimeEntity { | ||
|
@@ -42,7 +42,7 @@ public class User extends BaseTimeEntity { | |
@JoinColumn(name = "profile_image_id", foreignKey = @ForeignKey(name = "fk_user_profile_image"), nullable = false) | ||
private ProfileImage profileImage; | ||
|
||
private double reliability; | ||
private Double reliability; | ||
|
||
private String oauthId; | ||
|
||
|
@@ -53,7 +53,7 @@ public class User extends BaseTimeEntity { | |
private User( | ||
final String name, | ||
final ProfileImage profileImage, | ||
final double reliability, | ||
final Double reliability, | ||
final String oauthId | ||
) { | ||
this.name = name; | ||
|
16 changes: 0 additions & 16 deletions
16
backend/ddang/src/main/java/com/ddang/ddang/user/presentation/dto/ReadUserResponse.java
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -4,6 +4,6 @@ public record SellerResponse( | |
Long id, | ||
String image, | ||
String nickname, | ||
double reliability | ||
Double reliability | ||
) { | ||
} |
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
backend/ddang/src/test/java/com/ddang/ddang/auction/application/dto/ReadAuctionDtoTest.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 com.ddang.ddang.auction.application.dto; | ||
|
||
import com.ddang.ddang.auction.application.dto.fixture.ReadAuctionDtoFixture; | ||
import com.ddang.ddang.configuration.IsolateDatabase; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@IsolateDatabase | ||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
class ReadAuctionDtoTest extends ReadAuctionDtoFixture { | ||
|
||
@Test | ||
void 지정한_아이디에_해당하는_경매의_판매자_신뢰도가_null이라면_서비스에서_반환하는_dto에서_판매자_신뢰도를_나타내는_부분도_null이다() { | ||
// when | ||
final ReadAuctionDto actual = ReadAuctionDto.of(신뢰도가_null인_판매자의_경매, LocalDateTime.now()); | ||
|
||
// then | ||
assertThat(actual.sellerReliability()).isNull(); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
.../src/test/java/com/ddang/ddang/auction/application/dto/fixture/ReadAuctionDtoFixture.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,64 @@ | ||
package com.ddang.ddang.auction.application.dto.fixture; | ||
|
||
import com.ddang.ddang.auction.domain.Auction; | ||
import com.ddang.ddang.auction.domain.BidUnit; | ||
import com.ddang.ddang.auction.domain.Price; | ||
import com.ddang.ddang.auction.infrastructure.persistence.JpaAuctionRepository; | ||
import com.ddang.ddang.category.domain.Category; | ||
import com.ddang.ddang.category.infrastructure.persistence.JpaCategoryRepository; | ||
import com.ddang.ddang.image.domain.AuctionImage; | ||
import com.ddang.ddang.image.domain.ProfileImage; | ||
import com.ddang.ddang.region.infrastructure.persistence.JpaRegionRepository; | ||
import com.ddang.ddang.user.domain.User; | ||
import com.ddang.ddang.user.infrastructure.persistence.JpaUserRepository; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@SuppressWarnings("NonAsciiCharacters") | ||
public class ReadAuctionDtoFixture { | ||
|
||
@Autowired | ||
private JpaAuctionRepository auctionRepository; | ||
|
||
@Autowired | ||
private JpaRegionRepository regionRepository; | ||
|
||
@Autowired | ||
private JpaCategoryRepository categoryRepository; | ||
|
||
@Autowired | ||
private JpaUserRepository userRepository; | ||
|
||
private Category 가구_카테고리 = new Category("가구"); | ||
private Category 가구_서브_의자_카테고리 = new Category("의자"); | ||
protected User 신뢰도가_null인_판매자 = User.builder() | ||
.name("신뢰도가 null인 판매자") | ||
.profileImage(new ProfileImage("upload.png", "store.png")) | ||
.reliability(null) | ||
.oauthId("99999") | ||
.build(); | ||
protected Auction 신뢰도가_null인_판매자의_경매; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
userRepository.save(신뢰도가_null인_판매자); | ||
|
||
가구_카테고리.addSubCategory(가구_서브_의자_카테고리); | ||
categoryRepository.save(가구_카테고리); | ||
|
||
신뢰도가_null인_판매자의_경매 = Auction.builder() | ||
.title("신뢰도가 null인 판매자의 경매") | ||
.description("신뢰도가 null인 판매자의 경매") | ||
.subCategory(가구_서브_의자_카테고리) | ||
.seller(신뢰도가_null인_판매자) | ||
.bidUnit(new BidUnit(1_000)) | ||
.startPrice(new Price(10_000)) | ||
.closingTime(LocalDateTime.now().plusDays(3L)) | ||
.build(); | ||
신뢰도가_null인_판매자의_경매.addAuctionImages(List.of(new AuctionImage("auction.png", "auction.png"))); | ||
auctionRepository.save(신뢰도가_null인_판매자의_경매); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
질문
값 객체로 변경하게 된다면 null을 직접적으로 넣지 않고, 미리 null로 설정해 둔 값객체에 대한 static 필드를 사용하게 될까요?
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.
넵 값객체 적용한 pr에서 User 생성 시 reliability가 null이면 static 필드를 사용하도록 구현되어 있습니다!