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

로그인 시 회원 프로필 이미지 사진 추가 #235

Merged
merged 16 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public Member toEntity() {
.gender(Gender.from(getGender()))
.phoneNumber(getPhoneNumber())
.providerId(getProviderId())
.profileImageUrl(getProfileImageUrl())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,50 @@
@Entity
@Getter
public class Member extends BaseTimeEntity {

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

@Column(nullable = false, columnDefinition = "varchar(255)")
@Enumerated(EnumType.STRING)
private Gender gender;

@Column(nullable = false)
private String name;

@Column(nullable = false, length = 20)
private String phoneNumber;

@Column(nullable = false)
private String providerId;


@Column(nullable = false)
private String profileImageUrl;

@Builder.Default
@Column(nullable = false, columnDefinition = "varchar(255)")
@Enumerated(EnumType.STRING)
private Role role = USER;

@Builder.Default
@OneToMany(mappedBy = "member",fetch = FetchType.LAZY)
private List<Wish> wishes=new ArrayList<>();

protected Member() {

}

@Builder
public Member(final Long memberId, final Gender gender, final String name, final String phoneNumber, final String providerId) {
public Member(final Long memberId, final Gender gender, final String name, final String phoneNumber, final String providerId, final String profileImageUrl) {
this.memberId = memberId;
this.gender = gender;
this.name = name;
this.phoneNumber = phoneNumber;
this.providerId = providerId;
this.profileImageUrl = profileImageUrl;
}

@Override
public String toString() {
return "Member{" +
Expand All @@ -71,10 +75,11 @@ public String toString() {
", username='" + name + '\'' +
", phoneNumber='" + phoneNumber + '\'' +
", providerId='" + providerId + '\'' +
", profileImageUrl='" + profileImageUrl + '\'' +
", role=" + role +
'}';
}

public boolean isWishEmpty() {
return wishes == null || wishes.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import org.kakaoshare.backend.domain.product.dto.ProductSummaryResponse;

public record PaymentFundingSuccessResponse(Receiver receiver, ProductSummaryResponse product, Long attributeAmount) {
public record PaymentFundingSuccessResponse(PaymentSuccessReceiver receiver, ProductSummaryResponse product, Long attributeAmount) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

import java.util.List;

public record PaymentGiftSuccessResponse(Receiver receiver, List<OrderSummaryResponse> orders) {
public record PaymentGiftSuccessResponse(PaymentSuccessReceiver receiver, List<OrderSummaryResponse> orders) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.kakaoshare.backend.domain.payment.dto.success.response;

import org.kakaoshare.backend.domain.member.entity.Member;

public record PaymentSuccessReceiver(String name, String photoUrl) {
public static PaymentSuccessReceiver from(final Member member) {
return new PaymentSuccessReceiver(member.getName(), member.getProfileImageUrl());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.kakaoshare.backend.domain.payment.dto.success.request.PaymentSuccessRequest;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentFundingSuccessResponse;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentGiftSuccessResponse;
import org.kakaoshare.backend.domain.payment.dto.success.response.Receiver;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentSuccessReceiver;
import org.kakaoshare.backend.domain.payment.entity.Payment;
import org.kakaoshare.backend.domain.payment.entity.PaymentMethod;
import org.kakaoshare.backend.domain.payment.exception.PaymentErrorCode;
Expand Down Expand Up @@ -152,7 +152,7 @@ public PaymentGiftSuccessResponse approve(final String providerId,
saveOrders(payment, receipts);

final List<OrderSummaryResponse> orderSummaries = getOrderSummaries(orderDetails);
return new PaymentGiftSuccessResponse(Receiver.from(receiver), orderSummaries);
return new PaymentGiftSuccessResponse(PaymentSuccessReceiver.from(receiver), orderSummaries);
}

@Transactional
Expand All @@ -178,8 +178,8 @@ public PaymentFundingSuccessResponse approveFunding(final String providerId,

final Product product = funding.getProduct();
final ProductSummaryResponse productSummaryResponse = ProductSummaryResponse.from(product);
final Receiver receiver = Receiver.from(funding.getMember());
return new PaymentFundingSuccessResponse(receiver, productSummaryResponse, amount);
final PaymentSuccessReceiver paymentSuccessReceiver = PaymentSuccessReceiver.from(funding.getMember());
return new PaymentFundingSuccessResponse(paymentSuccessReceiver, productSummaryResponse, amount);
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE member
ADD COLUMN `profile_image_url` VARCHAR(255) NOT NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.kakaoshare.backend.domain.payment.dto.success.request.PaymentSuccessRequest;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentFundingSuccessResponse;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentGiftSuccessResponse;
import org.kakaoshare.backend.domain.payment.dto.success.response.Receiver;
import org.kakaoshare.backend.domain.payment.dto.success.response.PaymentSuccessReceiver;
import org.kakaoshare.backend.domain.payment.entity.Payment;
import org.kakaoshare.backend.domain.payment.entity.PaymentMethod;
import org.kakaoshare.backend.domain.payment.repository.PaymentRepository;
Expand Down Expand Up @@ -217,8 +217,8 @@ public void approveToMe() throws Exception {
new OrderSummaryResponse(cakeSummaryResponse, cakeStockQuantity, Collections.emptyList()),
new OrderSummaryResponse(coffeeSummaryResponse, coffeeStockQuantity, Collections.emptyList())
);
final Receiver receiver = Receiver.from(member);
final PaymentGiftSuccessResponse expect = new PaymentGiftSuccessResponse(receiver, orderSummaries);
final PaymentSuccessReceiver paymentSuccessReceiver = PaymentSuccessReceiver.from(member);
final PaymentGiftSuccessResponse expect = new PaymentGiftSuccessResponse(paymentSuccessReceiver, orderSummaries);
final PaymentGiftSuccessResponse actual = paymentService.approve(providerId, paymentSuccessRequest);
assertThat(actual).isEqualTo(expect); // TODO: 3/16/24 equals() 및 hashCode()가 재정의되있으므로 isEqualTo() 사용
}
Expand Down Expand Up @@ -279,8 +279,8 @@ public void approveToOther() throws Exception {
new OrderSummaryResponse(cakeSummaryResponse, cakeStockQuantity, Collections.emptyList()),
new OrderSummaryResponse(coffeeSummaryResponse, coffeeStockQuantity, Collections.emptyList())
);
final Receiver receiver = Receiver.from(receiverMember);
final PaymentGiftSuccessResponse expect = new PaymentGiftSuccessResponse(receiver, orderSummaries);
final PaymentSuccessReceiver paymentSuccessReceiver = PaymentSuccessReceiver.from(receiverMember);
final PaymentGiftSuccessResponse expect = new PaymentGiftSuccessResponse(paymentSuccessReceiver, orderSummaries);
final PaymentGiftSuccessResponse actual = paymentService.approve(providerId, paymentSuccessRequest);
assertThat(actual).isEqualTo(expect); // TODO: 3/16/24 equals() 및 hashCode()가 재정의되있으므로 isEqualTo() 사용
}
Expand Down Expand Up @@ -365,7 +365,7 @@ public void approveFunding() throws Exception {
doReturn(Optional.of(contributor)).when(memberRepository).findMemberByProviderId(providerId);

final ProductSummaryResponse productSummaryResponse = ProductSummaryResponse.from(cake);
final PaymentFundingSuccessResponse expect = new PaymentFundingSuccessResponse(Receiver.from(creator), productSummaryResponse, (long) attributeAmount);
final PaymentFundingSuccessResponse expect = new PaymentFundingSuccessResponse(PaymentSuccessReceiver.from(creator), productSummaryResponse, (long) attributeAmount);
final PaymentFundingSuccessResponse actual = paymentService.approveFunding(providerId, paymentSuccessRequest);

assertThat(actual).isEqualTo(expect);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public enum MemberFixture {
.gender(gender)
.phoneNumber(phoneNumber)
.providerId(providerId)
.profileImageUrl("defaultProfileImageUrl")
.build();
}
}