Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/develop_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- develop
pull_request:
branches:
- develop

env:
DOCKERHUB_USERNAME: ht3064
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/amcamp/domain/team/api/TeamController.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Slice;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -78,6 +79,7 @@ public TeamAdminResponse teamFindAdmin(@PathVariable Long teamId) {
return teamService.findTeamAdmin(teamId);
}

@Deprecated
@Operation(summary = "팀 목록 조회", description = "회원이 참여한 팀 목록을 조회합니다.")
@GetMapping("/list")
public Slice<TeamInfoResponse> teamFindAll(
Expand All @@ -88,4 +90,10 @@ public Slice<TeamInfoResponse> teamFindAll(
int pageSize) {
return teamService.findAllTeam(lastTeamId, pageSize);
}

@Operation(summary = "팀 목록 조회", description = "회원이 참여한 팀 목록을 조회합니다.")
@GetMapping("/list/all")
public List<TeamInfoResponse> teamFindAll() {
return teamService.findAllTeamV2();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.amcamp.global.util.MemberUtil;
import com.amcamp.global.util.RandomUtil;
import com.amcamp.global.util.RedisUtil;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Slice;
Expand Down Expand Up @@ -179,6 +180,12 @@ public Slice<TeamInfoResponse> findAllTeam(Long lastTeamId, int pageSize) {
return teamRepository.findAllTeamByMemberId(currentMember.getId(), lastTeamId, pageSize);
}

@Transactional(readOnly = true)
public List<TeamInfoResponse> findAllTeamV2() {
Member currentMember = memberUtil.getCurrentMember();
return teamRepository.findAllTeamByMemberIdV2(currentMember.getId());
}

@Transactional(readOnly = true)
public TeamAdminResponse findTeamAdmin(Long teamId) {
Member member = memberUtil.getCurrentMember();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package com.amcamp.domain.team.dao;

import com.amcamp.domain.team.dto.response.TeamInfoResponse;
import java.util.List;
import org.springframework.data.domain.Slice;

public interface TeamRepositoryCustom {
Slice<TeamInfoResponse> findAllTeamByMemberId(Long memberId, Long lastTeamId, int pageSize);

List<TeamInfoResponse> findAllTeamByMemberIdV2(Long memberId);
}
18 changes: 18 additions & 0 deletions src/main/java/com/amcamp/domain/team/dao/TeamRepositoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ public Slice<TeamInfoResponse> findAllTeamByMemberId(
return checkLastPage(pageSize, results);
}

@Override
public List<TeamInfoResponse> findAllTeamByMemberIdV2(Long memberId) {
return jpaQueryFactory
.select(
Projections.constructor(
TeamInfoResponse.class,
team.id,
team.name,
team.description,
team.emoji))
.from(teamParticipant)
.leftJoin(teamParticipant.team, team)
.on(team.id.eq(teamParticipant.team.id))
.where(teamParticipant.member.id.eq(memberId))
.orderBy(teamParticipant.createdDt.desc())
.fetch();
}

private BooleanExpression lastTeamId(Long teamId) {
if (teamId == null) {
return null;
Expand Down