Skip to content

Commit

Permalink
Merge pull request #122 from Hanaemong/nayoung
Browse files Browse the repository at this point in the history
Fix: 총무 fcm 및 모임통장 잔액 수정
  • Loading branch information
ny2060 authored Jul 9, 2024
2 parents a82e866 + 2adc271 commit 5e104bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ public class Account extends BaseEntity {
public void withDraw(Long amount) {
this.balance -= amount;
}
public void deposit(Long amount) { this.balance += amount; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hana.hanalink.team.controller;

import com.google.firebase.messaging.FirebaseMessagingException;
import com.hana.hanalink.common.dto.SuccessResponse;
import com.hana.hanalink.common.firebase.FirebaseFcmService;
import com.hana.hanalink.common.service.ImageUploadService;
import com.hana.hanalink.member.domain.MemberDetails;
import com.hana.hanalink.team.dto.request.CreateTeamReq;
Expand All @@ -23,6 +25,7 @@
public class TeamController {
private final TeamService teamService;
private final ImageUploadService imageUploadService;
private final FirebaseFcmService firebaseFcmService;

@PostMapping(value = "", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE})
public SuccessResponse<CreateTeamRes> createTeam(@AuthenticationPrincipal MemberDetails member,
Expand All @@ -43,8 +46,9 @@ public SuccessResponse<Void> updateBanner(@PathVariable("teamId") Long teamId,
@PostMapping("/{teamId}")
SuccessResponse<Void> joinTeam(@AuthenticationPrincipal MemberDetails member,
@PathVariable("teamId") Long teamId,
@RequestBody JoinTeamReq req) {
@RequestBody JoinTeamReq req) throws FirebaseMessagingException {
teamService.joinTeam(member.getUsername(), teamId, req);
firebaseFcmService.subscribeToTopic(member.getMemberFcmToken(),teamId.toString());
return SuccessResponse.successWithNoData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public Long paymentDues(Long teamId, TransactionReq transactionReq) {

/*내 계좌 출금*/
myAccountWithdraw(myAccount,transactionReq.amount());
meetingAccount.getAccount().deposit(transactionReq.amount());
accountRepository.save(meetingAccount.getAccount());

Transaction transaction = Transaction.builder()
.amount(transactionReq.amount())
Expand Down

0 comments on commit 5e104bc

Please sign in to comment.