Skip to content

Commit

Permalink
Feat: 실명 -> 닉네임 변경 #98
Browse files Browse the repository at this point in the history
  • Loading branch information
ny2060 committed Jul 6, 2024
1 parent 5659ed9 commit c374562
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ public record DetailTeamRes(
Float score,
String thumbNail,
String banner,
String nickName,
TeamMemberRole role
) {
public DetailTeamRes(Team team, TeamMemberRole role) {
public DetailTeamRes(Team team, TeamMemberRole role,String nickName) {
this(
team.getTeamId(),
team.getSiGunGu().getSiGunGu(),
Expand All @@ -24,6 +25,7 @@ public DetailTeamRes(Team team, TeamMemberRole role) {
team.getScore(),
team.getThumbNail(),
team.getBanner(),
nickName,
role
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public DetailTeamRes getDetailTeam(String phone, Long teamId) {
Optional<TeamMember> teamMemberOptional = teamMemberRepository.findByMemberAndTeam(member, team);
TeamMemberRole role = teamMemberOptional.map(TeamMember::getRole).orElse(null);

return new DetailTeamRes(team, role);
return new DetailTeamRes(team, role, teamMemberOptional.get().getNickname());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TeamMember extends BaseEntity {
public TeamMemberRes toDto(String gender,String profile,String name){
return TeamMemberRes.builder()
.teamMemberId(teamMemberId)
.name(name)
.nickName(name)
.gender(gender)
.profile(profile)
.role(role)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
import lombok.Builder;

@Builder
public record TeamMemberRes(Long teamMemberId,String profile, String name, String gender, TeamMemberRole role) {
public record TeamMemberRes(Long teamMemberId,String profile, String nickName, String gender, TeamMemberRole role) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TeamMemberService {

@Transactional(readOnly = true)
public List<TeamMemberRes> getTeamMembers(Long teamId) {
return teamMemberRepository.findTeamMemberByTeam_TeamId(teamId).stream().map(teamMember -> teamMember.toDto(teamMember.getMember().getGender(),teamMember.getMember().getProfile(),teamMember.getMember().getName())
return teamMemberRepository.findTeamMemberByTeam_TeamId(teamId).stream().map(teamMember -> teamMember.toDto(teamMember.getMember().getGender(),teamMember.getMember().getProfile(),teamMember.getNickname())
).toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public SuccessResponse<TransactionDetailRes> getTransactionHistory(@PathVariable

/*회비 납부하기*/
@PostMapping("/transaction/{teamId}")
public SuccessResponse<Long> createTransaction(@PathVariable("teamId") Long teamId, @RequestBody TransactionReq transactionReq,@AuthenticationPrincipal MemberDetails member){
return SuccessResponse.success(transactionService.paymentDues(teamId,transactionReq,member));
public SuccessResponse<Long> createTransaction(@PathVariable("teamId") Long teamId, @RequestBody TransactionReq transactionReq){
return SuccessResponse.success(transactionService.paymentDues(teamId,transactionReq));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public TransactionRes toTransMember(Member member) {
return TransactionRes.builder()
.memberGender(member.getGender())
.memberName(member.getName())
.memberNickname(transFrom)
.memberGender(member.getGender())
.amount(amount)
.memberProfile(member.getProfile())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.hana.hanalink.transaction.dto.request;

public record TransactionReq(Long amount, Long accountId) {
public record TransactionReq(Long amount, Long accountId, String nickName) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
public record TransactionRes(
String memberProfile,
String memberName,

String memberNickname,
String memberGender,
Long amount,
TransactionType type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
import com.hana.hanalink.account.repository.AccountRepository;
import com.hana.hanalink.accountto.domain.AccountTo;
import com.hana.hanalink.accountto.repository.AccountToRepository;
import com.hana.hanalink.common.service.PaymentTestData;
import com.hana.hanalink.common.exception.EntityNotFoundException;
import com.hana.hanalink.common.firebase.FirebaseFcmService;
import com.hana.hanalink.common.service.PaymentTestData;
import com.hana.hanalink.meetingacount.domain.MeetingAccount;
import com.hana.hanalink.meetingacount.repository.MeetingAccountRepository;
import com.hana.hanalink.member.domain.MemberDetails;
import com.hana.hanalink.team.domain.Team;
import com.hana.hanalink.team.exception.TeamNotFoundException;
import com.hana.hanalink.team.repository.TeamRepository;
import com.hana.hanalink.teammember.repository.TeamMemberRepository;
import com.hana.hanalink.transaction.domain.Transaction;
import com.hana.hanalink.transaction.domain.TransactionType;
import com.hana.hanalink.transaction.dto.request.TransactionReq;
Expand All @@ -36,6 +37,7 @@ public class TransactionService {

private final TransactionRepository transactionRepository;
private final MeetingAccountRepository meetingAccountRepository;
private final TeamMemberRepository teamMemberRepository;
private final TeamRepository teamRepository;
private final AccountRepository accountRepository;
private final AccountToRepository accountToRepository;
Expand All @@ -54,7 +56,7 @@ public TransactionDetailRes getTransHistory(Long teamId, YearMonth date){
List<Transaction> transactions = transactionRepository.findByAccountTo_AccountIdAndYearMonth(accountTo.getAccountToId(),date.getYear(),date.getMonthValue());

List<TransactionRes> transactionResList = transactions.stream().map(trans -> (
trans.toTransMember(trans.getAccountTo().getAccount().getMember()))).toList();
trans.toTransMember(trans.getAccountFrom().getMember()))).toList();

return TransactionDetailRes.builder()
.balance(account.getBalance()) //잔액
Expand Down Expand Up @@ -93,7 +95,7 @@ public PaymentCardResponse paymentCard(MemberDetails member,Long teamId) {
return new PaymentCardResponse(paidStore, paidAmount, LocalDateTime.now());
}

public Long paymentDues(Long teamId, TransactionReq transactionReq, MemberDetails member) {
public Long paymentDues(Long teamId, TransactionReq transactionReq) {

Long meetingAccountId = teamRepository.findById(teamId).orElseThrow(EntityNotFoundException::new).getMeetingAccount().getMeetingAccountId();
MeetingAccount meetingAccount = meetingAccountRepository.findById(meetingAccountId).orElseThrow(EntityNotFoundException::new);
Expand All @@ -109,7 +111,7 @@ public Long paymentDues(Long teamId, TransactionReq transactionReq, MemberDetail

Transaction transaction = Transaction.builder()
.amount(transactionReq.amount())
.transFrom(member.getMemberName())
.transFrom(transactionReq.nickName())
.transTo(team.getTeamName())
.accountFrom(myAccount)
.accountTo(chairAccount)
Expand Down

0 comments on commit c374562

Please sign in to comment.