From 56f33c809d1cea583f7644fa96226e988e017682 Mon Sep 17 00:00:00 2001 From: yumzen Date: Sun, 22 Sep 2024 23:48:04 +0900 Subject: [PATCH 1/7] =?UTF-8?q?refactor:=20teamRes=20=EB=A6=AC=ED=8C=A9?= =?UTF-8?q?=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/team/dto/response/TeamRes.java | 15 +++++++++++-- .../domain/team/service/TeamService.java | 21 ++++++++----------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/team/dto/response/TeamRes.java b/src/main/java/com/gongjakso/server/domain/team/dto/response/TeamRes.java index 931bf87..66ab861 100644 --- a/src/main/java/com/gongjakso/server/domain/team/dto/response/TeamRes.java +++ b/src/main/java/com/gongjakso/server/domain/team/dto/response/TeamRes.java @@ -115,7 +115,7 @@ public static RecruitPartRes of(RecruitPart recruitPart) { } - public static TeamRes of(Team team, String teamRole, Apply apply) { + public static TeamResBuilder teamResBuilder(Team team){ List recruitPartRes = (team.getRecruitPart() != null) ? team.getRecruitPart().stream() .map(RecruitPartRes::of) .toList() : null; @@ -127,7 +127,7 @@ public static TeamRes of(Team team, String teamRole, Apply apply) { .contestId(team.getContest().getId()) .contestTitle(team.getContest().getTitle()) .title(team.getTitle()) - .body(team.getTitle()) + .body(team.getBody()) .status(team.getStatus().getDescription()) .totalCount(team.getTotalCount()) .passCount(team.getPassCount()) @@ -142,6 +142,17 @@ public static TeamRes of(Team team, String teamRole, Apply apply) { .channelLink(team.getChannelLink()) .contestLink(team.getContest().getContestLink()) .scrapCount(team.getScrapCount()) + .viewCount(team.getViewCount()); + } + + public static TeamRes of(Team team, String teamRole){ + return teamResBuilder(team) + .teamRole(teamRole) + .build(); + } + + public static TeamRes of(Team team, String teamRole, Apply apply){ + return teamResBuilder(team) .teamRole(teamRole) .applyStatus(apply != null ? apply.getStatus().getDescription() : null) .applyId(apply != null ? apply.getId() : null) diff --git a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java index cbdd10a..ed20f43 100644 --- a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java +++ b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java @@ -47,7 +47,7 @@ public TeamRes createTeam(Member member, Long contestId, TeamReq teamReq) { Team savedTeam = teamRepository.save(team); // Response - return TeamRes.of(savedTeam, "LEADER", null); + return TeamRes.of(savedTeam, "LEADER"); } @Transactional @@ -69,7 +69,7 @@ public TeamRes updateTeam(Member member, Long contestId, Long teamId, TeamReq te Team updatedTeam = teamRepository.save(team); // Response - return TeamRes.of(updatedTeam, "LEADER", null); + return TeamRes.of(updatedTeam, "LEADER"); } @Transactional @@ -92,7 +92,7 @@ public TeamRes extendRecruit(Member member, Long contestId, Long teamId, LocalDa Team updatedTeam = teamRepository.save(team); // Response - return TeamRes.of(updatedTeam, "LEADER", null); + return TeamRes.of(updatedTeam, "LEADER"); } @Transactional @@ -114,7 +114,7 @@ public TeamRes closeRecruit(Member member, Long contestId, Long teamId) { Team updatedTeam = teamRepository.save(team); // Response - return TeamRes.of(updatedTeam, "LEADER", null); + return TeamRes.of(updatedTeam, "LEADER"); } @Transactional @@ -136,7 +136,7 @@ public TeamRes cancelRecruit(Member member, Long contestId, Long teamId) { Team updatedTeam = teamRepository.save(team); // Response - return TeamRes.of(updatedTeam, "LEADER", null); + return TeamRes.of(updatedTeam, "LEADER"); } @Transactional @@ -168,19 +168,16 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId) { throw new ApplicationException(ErrorCode.TEAM_NOT_FOUND_EXCEPTION); } - String teamRole = "GENERAL"; - Apply apply = null; - if(member != null && team.getMember().getId().equals(member.getId())){ - teamRole = "LEADER"; + return TeamRes.of(team, "LEADER"); }else if(member != null && applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()).isPresent()){ - teamRole = "APPLIER"; - apply = applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()) + Apply apply = applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()) .orElseThrow(() -> new ApplicationException(ErrorCode.APPLY_NOT_FOUND_EXCEPTION)); + return TeamRes.of(team, "APPLIER", apply); } // Business Logic - return TeamRes.of(team, teamRole, apply); + return TeamRes.of(team, "GENERAL"); } public Page getTeamListWithContest(Long contestId, String province, String district, Pageable pageable) { From 7d49ce80eba053f278b27e05a565b01af8d2c796 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 00:07:27 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[#238]=20feat:=20team=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=EC=88=98=20=EA=B8=B0=EB=8A=A5=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/controller/TeamController.java | 8 +++-- .../server/domain/team/entity/Team.java | 6 +++- .../domain/team/service/TeamService.java | 33 +++++++++++++++++-- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/team/controller/TeamController.java b/src/main/java/com/gongjakso/server/domain/team/controller/TeamController.java index 8cd4248..997c031 100644 --- a/src/main/java/com/gongjakso/server/domain/team/controller/TeamController.java +++ b/src/main/java/com/gongjakso/server/domain/team/controller/TeamController.java @@ -10,6 +10,8 @@ import com.gongjakso.server.global.security.PrincipalDetails; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -85,8 +87,10 @@ public ApplicationResponse deleteTeam(@AuthenticationPrincipal PrincipalDe @GetMapping("/contest/{contest_id}/team/{team_id}") public ApplicationResponse getTeam(@AuthenticationPrincipal PrincipalDetails principalDetails, @PathVariable(value = "contest_id") Long contestId, - @PathVariable(value = "team_id") Long teamId) { - return ApplicationResponse.ok(teamService.getTeam(principalDetails == null ? null : principalDetails.getMember(), contestId, teamId)); + @PathVariable(value = "team_id") Long teamId, + HttpServletRequest request, + HttpServletResponse response) { + return ApplicationResponse.ok(teamService.getTeam(principalDetails == null ? null : principalDetails.getMember(), contestId, teamId, request, response)); } @Operation(summary = "팀 리스트 조회 API", description = "특정 공모전에 해당하는 팀 리스트를 조회하는 API (오프셋 기반 페이지네이션)") diff --git a/src/main/java/com/gongjakso/server/domain/team/entity/Team.java b/src/main/java/com/gongjakso/server/domain/team/entity/Team.java index 6adc4a6..498b04e 100644 --- a/src/main/java/com/gongjakso/server/domain/team/entity/Team.java +++ b/src/main/java/com/gongjakso/server/domain/team/entity/Team.java @@ -86,7 +86,7 @@ public class Team extends BaseTimeEntity { private int scrapCount; @Column(name = "view_count", nullable = false, columnDefinition = "int") - private int viewCount; + private Integer viewCount; public void update(TeamReq teamReq) { this.title = (teamReq.title() != null) ? teamReq.title() : this.title; @@ -113,6 +113,10 @@ public void updateScrapCount(int scrapCount) { this.scrapCount = scrapCount; } + public void updateViewCount(Team team){ + this.viewCount = team.getViewCount() + 1; + } + @Builder public Team(Member member, Contest contest, diff --git a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java index ed20f43..d6ff07d 100644 --- a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java +++ b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java @@ -17,6 +17,9 @@ import com.gongjakso.server.domain.team.repository.TeamRepository; import com.gongjakso.server.global.exception.ApplicationException; import com.gongjakso.server.global.exception.ErrorCode; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -157,8 +160,8 @@ public void deleteTeam(Member member, Long contestId, Long teamId) { teamRepository.delete(team); } - // TODO: 조회수 관련 로직 도입 및 @Transactional 도입 필요 - public TeamRes getTeam(Member member, Long contestId, Long teamId) { + // TODO: @Transactional 도입 필요 + public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRequest request, HttpServletResponse response) { // Validation contestRepository.findByIdAndDeletedAtIsNull(contestId) .orElseThrow(() -> new ApplicationException(ErrorCode.CONTEST_NOT_FOUND_EXCEPTION)); @@ -176,6 +179,8 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId) { return TeamRes.of(team, "APPLIER", apply); } + updateView(team, request, response); + // Business Logic return TeamRes.of(team, "GENERAL"); } @@ -312,4 +317,28 @@ public List getApplyList(Member member, Long teamId) { .map(SimpleApplyRes::of) .toList(); } + + public void updateView(Team team, HttpServletRequest request, HttpServletResponse response) { + boolean hasViewed = false; + Cookie[] cookies = request.getCookies(); + + String COOKIE_NAME = "team_view"; + if (cookies != null) { + for (Cookie cookie : cookies) { + if (cookie.getName().equals(COOKIE_NAME)) { + hasViewed = true; + break; + } + } + } + + if (!hasViewed) { + team.updateViewCount(team); + // 세션 쿠키 설정 + Cookie newCookie = new Cookie(COOKIE_NAME, "viewed"); + newCookie.setMaxAge(-1); // 브라우저 세션이 끝날 때까지 유효 + newCookie.setPath("/"); + response.addCookie(newCookie); + } + } } From 32fa1d11e3834e3e93a0503f61cd91e149f5f082 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 00:10:50 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[#238]=20feat:=20apply=20=EC=A7=80=EC=9B=90?= =?UTF-8?q?=EC=9D=B4=EC=9C=A0=20=EA=B8=80=EC=9E=90=EC=88=98=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gongjakso/server/domain/apply/dto/request/ApplyReq.java | 2 +- .../gongjakso/server/domain/apply/dto/response/ApplyRes.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java b/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java index 130f225..f613100 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/request/ApplyReq.java @@ -25,7 +25,7 @@ public record ApplyReq( @Schema(description = "포트폴리오 공개 설정", example = "false") Boolean isPrivate, - @Size(max = 500) + @Size(max = 1000) @Schema(description = "지원 이유", example = "저는 데이터 사이언스 과목을 수강하며 데이터에 관한 기본적인 내용들을 배우며 이런 데이터를 잘 활용하고, 이용하는 것이 중요한 역량이 될 것 같다고 판단했습니다. 그래서 관련된 역량을 쌓고자 공모전에 출품하고 싶다는 생각을 가지게 되었고, 공공데이터 공모전이 적합하다고 생각했습니다!") String body, diff --git a/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java b/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java index fadcb50..92e2c26 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java +++ b/src/main/java/com/gongjakso/server/domain/apply/dto/response/ApplyRes.java @@ -32,7 +32,7 @@ public record ApplyRes( Boolean isPrivate, - @Size(max = 500) + @Size(max = 1000) String body, @Size(max = 20) From 1359860ba1aaa7e4480a53f3cd68322c7004e4d9 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 00:27:23 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[#238]=20feat:=20passCount=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/apply/repository/ApplyRepository.java | 3 ++- .../com/gongjakso/server/domain/team/entity/Team.java | 4 ++++ .../gongjakso/server/domain/team/service/TeamService.java | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gongjakso/server/domain/apply/repository/ApplyRepository.java b/src/main/java/com/gongjakso/server/domain/apply/repository/ApplyRepository.java index d4a4589..97ddd1e 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/repository/ApplyRepository.java +++ b/src/main/java/com/gongjakso/server/domain/apply/repository/ApplyRepository.java @@ -1,6 +1,7 @@ package com.gongjakso.server.domain.apply.repository; import com.gongjakso.server.domain.apply.entity.Apply; +import com.gongjakso.server.domain.apply.enumerate.ApplyStatus; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; @@ -9,7 +10,7 @@ public interface ApplyRepository extends JpaRepository, ApplyRepositoryCustom { Boolean existsByMemberIdAndTeamIdAndDeletedAtIsNull(Long memberId, Long teamId); Optional findByIdAndDeletedAtIsNull(Long applyId); - Optional findByTeamIdAndDeletedAtIsNull(Long teamId); Optional findByTeamIdAndMemberIdAndDeletedAtIsNull(Long teamId, Long memberId); List findAllByTeamIdAndDeletedAtIsNull(Long teamId); + int countByTeamIdAndStatusAndDeletedAtIsNull(Long teamId, ApplyStatus status); } diff --git a/src/main/java/com/gongjakso/server/domain/team/entity/Team.java b/src/main/java/com/gongjakso/server/domain/team/entity/Team.java index 498b04e..063428c 100644 --- a/src/main/java/com/gongjakso/server/domain/team/entity/Team.java +++ b/src/main/java/com/gongjakso/server/domain/team/entity/Team.java @@ -117,6 +117,10 @@ public void updateViewCount(Team team){ this.viewCount = team.getViewCount() + 1; } + public void updatePassCount(int passCount) { + this.passCount = passCount; + } + @Builder public Team(Member member, Contest contest, diff --git a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java index d6ff07d..37d4bec 100644 --- a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java +++ b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java @@ -2,6 +2,7 @@ import com.gongjakso.server.domain.apply.dto.response.SimpleApplyRes; import com.gongjakso.server.domain.apply.entity.Apply; +import com.gongjakso.server.domain.apply.enumerate.ApplyStatus; import com.gongjakso.server.domain.apply.repository.ApplyRepository; import com.gongjakso.server.domain.contest.entity.Contest; import com.gongjakso.server.domain.contest.repository.ContestRepository; @@ -171,6 +172,8 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRe throw new ApplicationException(ErrorCode.TEAM_NOT_FOUND_EXCEPTION); } + getPassCount(team); + if(member != null && team.getMember().getId().equals(member.getId())){ return TeamRes.of(team, "LEADER"); }else if(member != null && applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()).isPresent()){ @@ -341,4 +344,9 @@ public void updateView(Team team, HttpServletRequest request, HttpServletRespons response.addCookie(newCookie); } } + + public void getPassCount(Team team) { + int passCount = applyRepository.countByTeamIdAndStatusAndDeletedAtIsNull(team.getId(), ApplyStatus.ACCEPTED); + team.updatePassCount(passCount); + } } From 3b2de472c0dd1a125881966eda68bcbba6a1f4d0 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 00:46:11 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[#238]=20feat:=20@Transactional=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gongjakso/server/domain/team/service/TeamService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java index 37d4bec..aa2e08e 100644 --- a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java +++ b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java @@ -161,7 +161,7 @@ public void deleteTeam(Member member, Long contestId, Long teamId) { teamRepository.delete(team); } - // TODO: @Transactional 도입 필요 + @Transactional public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRequest request, HttpServletResponse response) { // Validation contestRepository.findByIdAndDeletedAtIsNull(contestId) From 3e57ac3f55f2a56bf95599256c5983e066521523 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 00:58:28 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[#238]=20fix:=20passCount=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/domain/apply/service/ApplyService.java | 15 +++++++++++++++ .../server/domain/team/service/TeamService.java | 7 ------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java index b5a8796..981baf1 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java +++ b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java @@ -1,5 +1,6 @@ package com.gongjakso.server.domain.apply.service; +import com.gongjakso.server.domain.apply.enumerate.ApplyStatus; import com.gongjakso.server.domain.member.entity.Member; import com.gongjakso.server.domain.portfolio.entity.Portfolio; import com.gongjakso.server.domain.portfolio.repository.PortfolioRepository; @@ -16,6 +17,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.chrono.ChronoLocalDate; @@ -23,12 +25,14 @@ @Service @RequiredArgsConstructor +@Transactional(readOnly = true) public class ApplyService { private final ApplyRepository applyRepository; private final PortfolioRepository portfolioRepository; private final TeamRepository teamRepository; + @Transactional public ApplyRes apply(Member member, Long teamId, ApplyReq applyReq) { //Validation: teamId, 지원 가능 기간인지, 리더가 지원하는지, 이미 지원했는지, 본인의 포트폴리오인지 유효성 검사 Team team = teamRepository.findTeamById(teamId) @@ -73,6 +77,7 @@ public Page getMyApplies(Member member, Pageable pageable) { return applyPage; } + @Transactional public ApplyRes getApply(Member member, Long applyId) { //Validation: Apply가 유효하지 않거나, 리더가 아니거나, 자신이 아닌 경우 예외 처리 Apply apply = applyRepository.findApplyDetails(applyId) @@ -92,6 +97,7 @@ public ApplyRes getApply(Member member, Long applyId) { return ApplyRes.of(apply); } + @Transactional public ApplyRes selectApply(Member member, Long applyId, StatusReq req){ //Validation: Apply가 유효하지 않거나, 리더가 아닌 경우 예외 처리 Apply apply = applyRepository.findApplyDetails(applyId).orElseThrow(() -> new ApplicationException(ErrorCode.APPLY_NOT_FOUND_EXCEPTION)); @@ -103,6 +109,7 @@ public ApplyRes selectApply(Member member, Long applyId, StatusReq req){ //Business Logic if (req != null) { apply.select(req.status()); + updatePassCount(apply.getTeam()); } applyRepository.save(apply); @@ -111,6 +118,7 @@ public ApplyRes selectApply(Member member, Long applyId, StatusReq req){ return ApplyRes.of(apply); } + @Transactional public void cancelApply(Member member, Long applyId) { //Validation: Apply가 유효하지 않거나, 지원자 아닌 경우 예외 처리 Apply apply = applyRepository.findByIdAndDeletedAtIsNull(applyId) @@ -120,7 +128,14 @@ public void cancelApply(Member member, Long applyId) { throw new ApplicationException(ErrorCode.UNAUTHORIZED_EXCEPTION); } + updatePassCount(apply.getTeam()); + //Business Logic applyRepository.delete(apply); } + + public void updatePassCount(Team team) { + int passCount = applyRepository.countByTeamIdAndStatusAndDeletedAtIsNull(team.getId(), ApplyStatus.ACCEPTED); + team.updatePassCount(passCount); + } } diff --git a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java index aa2e08e..06b1f04 100644 --- a/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java +++ b/src/main/java/com/gongjakso/server/domain/team/service/TeamService.java @@ -172,8 +172,6 @@ public TeamRes getTeam(Member member, Long contestId, Long teamId, HttpServletRe throw new ApplicationException(ErrorCode.TEAM_NOT_FOUND_EXCEPTION); } - getPassCount(team); - if(member != null && team.getMember().getId().equals(member.getId())){ return TeamRes.of(team, "LEADER"); }else if(member != null && applyRepository.findByTeamIdAndMemberIdAndDeletedAtIsNull(teamId, member.getId()).isPresent()){ @@ -344,9 +342,4 @@ public void updateView(Team team, HttpServletRequest request, HttpServletRespons response.addCookie(newCookie); } } - - public void getPassCount(Team team) { - int passCount = applyRepository.countByTeamIdAndStatusAndDeletedAtIsNull(team.getId(), ApplyStatus.ACCEPTED); - team.updatePassCount(passCount); - } } From 58e5ae695bbb7d8d79bb0c5bb8e97a90bfab4552 Mon Sep 17 00:00:00 2001 From: yumzen Date: Mon, 23 Sep 2024 01:09:47 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[#238]=20fix:=20passCount=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gongjakso/server/domain/apply/service/ApplyService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java index 981baf1..849914d 100644 --- a/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java +++ b/src/main/java/com/gongjakso/server/domain/apply/service/ApplyService.java @@ -128,10 +128,10 @@ public void cancelApply(Member member, Long applyId) { throw new ApplicationException(ErrorCode.UNAUTHORIZED_EXCEPTION); } - updatePassCount(apply.getTeam()); - //Business Logic applyRepository.delete(apply); + + updatePassCount(apply.getTeam()); } public void updatePassCount(Team team) {