diff --git a/.github/workflows/core-application-prod-ci-cd-flow.yml b/.github/workflows/core-application-prod-ci-cd-flow.yml index edcde46bf..7a0839d53 100644 --- a/.github/workflows/core-application-prod-ci-cd-flow.yml +++ b/.github/workflows/core-application-prod-ci-cd-flow.yml @@ -125,9 +125,9 @@ jobs: docker ps -q --filter "name=core" | xargs -r docker stop docker ps -aq --filter "name=core" | xargs -r docker rm aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_DOCKER_USER }} --password-stdin ${{ secrets.AWS_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com - docker image prune -f + docker image prune -f -a docker pull ${{ steps.meta.outputs.tags }} - docker run -d -p 8080:8080 -p 9292:9292 -e ENVIRONMENT=prod --name core --network ec2-user_backend ${{ steps.meta.outputs.tags }} + docker run -d -p 8080:8080 -e ENVIRONMENT=prod -v /home/ec2-user/logs:/logs --name core --network ec2-user_backend ${{ steps.meta.outputs.tags }} - name: Remove Github Actions IP from security group if: always() diff --git a/.github/workflows/core-application-test-ci-cd-flow.yml b/.github/workflows/core-application-test-ci-cd-flow.yml index bd2f4ee1b..3ad7ecca1 100644 --- a/.github/workflows/core-application-test-ci-cd-flow.yml +++ b/.github/workflows/core-application-test-ci-cd-flow.yml @@ -125,9 +125,9 @@ jobs: docker ps -q --filter "name=core" | xargs -r docker stop docker ps -aq --filter "name=core" | xargs -r docker rm aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_TEST_ENV_DOCKER_USER }} --password-stdin ${{ secrets.AWS_TEST_ENV_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com - docker image prune -f + docker image prune -f -a docker pull ${{ steps.meta.outputs.tags }} - docker run -d -p 8080:8080 -e ENVIRONMENT=container --name core --network test_backend ${{ steps.meta.outputs.tags }} + docker run -d -p 8080:8080 -e ENVIRONMENT=container -v /home/ec2-user/logs:/logs --name core --network test_backend ${{ steps.meta.outputs.tags }} - name: Remove Github Actions IP from security group if: always() diff --git a/.gitignore b/.gitignore index 0fd891e42..922d6f840 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ backend/data +backend/docker-volumes + .env \ No newline at end of file diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApi.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApi.java index 1787aa40b..b78bb9d67 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApi.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApi.java @@ -8,6 +8,7 @@ import site.timecapsulearchive.core.global.common.response.ApiSpec; public interface AnnouncementApi { + @Operation( summary = "공지사항 페이지", description = "모든 공지사항을 가져온다. 최신 공지가 리스트의 맨 처음에 위치한다.", diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApiController.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApiController.java index 5f2f2e136..c85a16d78 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApiController.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApiController.java @@ -6,8 +6,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import site.timecapsulearchive.core.domain.announcement.data.response.AnnouncementsResponse; import site.timecapsulearchive.core.domain.announcement.data.dto.AnnouncementDto; +import site.timecapsulearchive.core.domain.announcement.data.response.AnnouncementsResponse; import site.timecapsulearchive.core.domain.announcement.service.AnnouncementService; import site.timecapsulearchive.core.global.common.response.ApiSpec; import site.timecapsulearchive.core.global.common.response.SuccessCode; diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java index 3d0bebde0..16a6161a1 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/generic_capsule/repository/capsule/CapsuleQueryRepositoryImpl.java @@ -65,8 +65,9 @@ public List findARCapsuleSummaryDtosByCurrentLocation ) ) .from(capsule) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.member, member) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) .where( ST_Contains(mbr, capsule.point).and(capsuleFilter(capsuleType, memberId, groupIds))) .fetch(); @@ -114,8 +115,6 @@ public List findCapsuleSummaryDtosByCurrentLocationAndC ) ) .from(capsule) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.member, member) .where( ST_Contains(mbr, capsule.point).and(capsuleFilter(capsuleType, memberId, groupIds))) .fetch(); @@ -143,8 +142,6 @@ public List findFriendsCapsuleSummaryDtosByCurrentLocat ) ) .from(capsule) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.member, member) .where(ST_Contains(mbr, capsule.point).and(capsule.member.id.in(friendIds)) .and(capsule.type.eq(CapsuleType.PUBLIC))) .fetch(); @@ -181,8 +178,9 @@ public List findFriendsARCapsulesByCurrentLocation( ) ) .from(capsule) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.member, member) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) .where(ST_Contains(mbr, capsule.point).and(capsule.member.id.in(friendIds)) .and(capsule.type.eq(CapsuleType.PUBLIC))) .fetch(); @@ -201,7 +199,8 @@ public Optional findTreasureCapsuleSummary(final Long ) ) .from(capsule) - .join(capsule.capsuleSkin, capsuleSkin) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) .where(capsule.id.eq(capsuleId)) .fetchOne() ); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/api/GroupCapsuleApi.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/api/GroupCapsuleApi.java index 9c315d56f..a8dced346 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/api/GroupCapsuleApi.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/api/GroupCapsuleApi.java @@ -121,7 +121,7 @@ ResponseEntity> getGroupCapsules( @Max(value = 40, message = "최대 페이징 크기는 40입니다.") int size, - @Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디", required = true) + @Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디") Long lastCapsuleId ); @@ -151,7 +151,7 @@ ResponseEntity> getGroupSpecificCapsu @Parameter(in = ParameterIn.QUERY, description = "페이지 크기", required = true) int size, - @Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디", required = true) + @Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디") Long lastCapsuleId ); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleOpenQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleOpenQueryRepositoryImpl.java index d86a90b40..600f5e157 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleOpenQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleOpenQueryRepositoryImpl.java @@ -75,8 +75,9 @@ public List findGroupCapsuleMembers( ) ) .from(groupCapsuleOpen) - .join(memberGroup).on(groupCapsuleOpen.member.id.eq(memberGroup.member.id)) - .join(groupCapsuleOpen.member, member) + .join(memberGroup) + .on(groupCapsuleOpen.member.eq(memberGroup.member), memberGroup.deletedAt.isNull()) + .join(member).on(groupCapsuleOpen.member.eq(member), member.deletedAt.isNull()) .where(groupCapsuleOpen.group.id.eq(groupId) .and(groupCapsuleOpen.capsule.id.eq(capsuleId)) .and(memberGroup.group.id.eq(groupId)) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleQueryRepository.java index be96a98b2..a34b3b958 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/group_capsule/repository/GroupCapsuleQueryRepository.java @@ -1,8 +1,6 @@ package site.timecapsulearchive.core.domain.capsule.group_capsule.repository; -import static com.querydsl.core.group.GroupBy.groupBy; import static site.timecapsulearchive.core.domain.capsule.entity.QCapsule.capsule; -import static site.timecapsulearchive.core.domain.capsule.entity.QGroupCapsuleOpen.groupCapsuleOpen; import static site.timecapsulearchive.core.domain.capsule.entity.QImage.image; import static site.timecapsulearchive.core.domain.capsule.entity.QVideo.video; import static site.timecapsulearchive.core.domain.capsuleskin.entity.QCapsuleSkin.capsuleSkin; @@ -26,7 +24,6 @@ import site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto.GroupCapsuleDto; import site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto.GroupCapsuleSummaryDto; import site.timecapsulearchive.core.domain.capsule.group_capsule.data.dto.GroupSpecificCapsuleSliceRequestDto; -import site.timecapsulearchive.core.domain.member.entity.QMember; import site.timecapsulearchive.core.global.util.SliceUtil; @Repository @@ -63,10 +60,11 @@ public Optional findGroupCapsuleDetailDtoByCapsuleId( ) .from(capsule) .join(capsule.member, member) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) - .join(capsule.group, group) - .leftJoin(image).on(capsule.id.eq(image.capsule.id)) - .leftJoin(video).on(capsule.id.eq(video.capsule.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(group).on(capsule.group.eq(group), group.deletedAt.isNull()) + .leftJoin(image).on(capsule.eq(image.capsule), image.deletedAt.isNull()) + .leftJoin(video).on(capsule.eq(video.capsule), video.deletedAt.isNull()) .where(capsule.id.eq(capsuleId).and(capsule.type.eq(CapsuleType.GROUP))) .fetchOne() ); @@ -101,9 +99,10 @@ public Optional findGroupCapsuleSummaryDtoByCapsuleId( ) ) .from(capsule) - .join(capsule.member, member) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.group, group) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .join(group).on(capsule.group.eq(group), group.deletedAt.isNull()) .where(capsule.id.eq(capsuleId) .and(capsule.type.eq(CapsuleType.GROUP)) ) @@ -130,8 +129,9 @@ public Slice findMyGroupCapsuleSlice( ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) .where(capsule.member.id.eq(memberId) .and(capsule.createdAt.lt(createdAt)) .and(capsule.type.eq(CapsuleType.GROUP))) @@ -222,11 +222,12 @@ public Slice findGroupCapsuleSlice( ) ) .from(capsule) - .join(capsule.member, member) - .join(capsule.capsuleSkin, capsuleSkin) - .join(capsule.group, group) - .leftJoin(image).on(capsule.id.eq(image.capsule.id)) - .leftJoin(video).on(capsule.id.eq(video.capsule.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .join(group).on(capsule.group.eq(group), group.deletedAt.isNull()) + .leftJoin(image).on(capsule.eq(image.capsule), image.deletedAt.isNull()) + .leftJoin(video).on(capsule.eq(video.capsule), video.deletedAt.isNull()) .where(capsule.type.eq(CapsuleType.GROUP) .and(capsule.group.id.in(groupIds)) .and(capsuleIdPagingCursorCondition(lastCapsuleId))) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/public_capsule/repository/PublicCapsuleQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/public_capsule/repository/PublicCapsuleQueryRepository.java index f81780359..2ca2d7797 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/public_capsule/repository/PublicCapsuleQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/public_capsule/repository/PublicCapsuleQueryRepository.java @@ -72,12 +72,13 @@ public Optional findPublicCapsuleDetailDtosByMemberIdAnd ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) - .leftJoin(memberFriend).on(capsule.member.id.eq(memberFriend.owner.id) - .or(capsule.member.id.eq(memberFriend.friend.id))) - .leftJoin(image).on(capsule.id.eq(image.capsule.id)) - .leftJoin(video).on(capsule.id.eq(video.capsule.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .leftJoin(memberFriend).on(capsule.member.eq(memberFriend.owner) + .or(capsule.member.eq(memberFriend.friend)), memberFriend.deletedAt.isNull()) + .leftJoin(image).on(capsule.eq(image.capsule), image.deletedAt.isNull()) + .leftJoin(video).on(capsule.eq(video.capsule), video.deletedAt.isNull()) .where(capsule.id.eq(capsuleId).and(capsule.type.eq(CapsuleType.PUBLIC)) .and(eqMemberIdOrFriendId(memberId))) .fetchFirst(); @@ -118,10 +119,11 @@ public Optional findPublicCapsuleSummaryDtosByMemberIdA ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) - .leftJoin(memberFriend).on(capsule.member.id.eq(memberFriend.owner.id) - .or(capsule.member.id.eq(memberFriend.friend.id))) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .leftJoin(memberFriend).on(capsule.member.eq(memberFriend.owner) + .or(capsule.member.eq(memberFriend.friend)), memberFriend.deletedAt.isNull()) .where(capsule.id.eq(capsuleId).and(capsule.type.eq(CapsuleType.PUBLIC)) .and(eqMemberIdOrFriendId(memberId))) .groupBy(capsule.id) @@ -167,10 +169,11 @@ public Slice findPublicCapsulesDtoMadeByFriend( ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) - .leftJoin(image).on(capsule.id.eq(image.capsule.id)) - .leftJoin(video).on(capsule.id.eq(video.capsule.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .leftJoin(image).on(capsule.eq(image.capsule), image.deletedAt.isNull()) + .leftJoin(video).on(capsule.eq(video.capsule), video.deletedAt.isNull()) .where(capsule.member.id.in(memberIds) .and(capsule.createdAt.lt(createdAt)) .and(capsule.type.eq(CapsuleType.PUBLIC))) @@ -202,8 +205,9 @@ public Slice findMyPublicCapsuleSlice( ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) .where(capsule.member.id.eq(memberId) .and(capsule.createdAt.lt(createdAt)) .and(capsule.type.eq(CapsuleType.PUBLIC))) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/secret_capsule/repository/SecretCapsuleQueryRepository.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/secret_capsule/repository/SecretCapsuleQueryRepository.java index fff856330..6c8a8fcf0 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/secret_capsule/repository/SecretCapsuleQueryRepository.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsule/secret_capsule/repository/SecretCapsuleQueryRepository.java @@ -82,10 +82,11 @@ public Optional findSecretCapsuleDetailDtosByMemberIdAndCapsul ) ) .from(capsule) - .join(member).on(capsule.member.id.eq(member.id)) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) - .leftJoin(image).on(capsule.id.eq(image.capsule.id)) - .leftJoin(video).on(capsule.id.eq(video.capsule.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) + .join(member).on(capsule.member.eq(member), member.deletedAt.isNull()) + .leftJoin(image).on(capsule.eq(image.capsule), image.deletedAt.isNull()) + .leftJoin(video).on(capsule.eq(video.capsule), video.deletedAt.isNull()) .where( capsule.id.eq(capsuleId) .and(capsule.member.id.eq(memberId)) @@ -122,7 +123,8 @@ public Slice findSecretCapsuleSliceByMemberIdAndCreatedAt( ) ) .from(capsule) - .join(capsuleSkin).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) + .join(capsuleSkin) + .on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) .where( capsule.member.id.eq(memberId), capsule.createdAt.lt(createdAt), diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/data/dto/CapsuleSkinDeleteResultDto.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/data/dto/CapsuleSkinDeleteResultDto.java index 11328b679..8c035812c 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/data/dto/CapsuleSkinDeleteResultDto.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/data/dto/CapsuleSkinDeleteResultDto.java @@ -6,7 +6,8 @@ public record CapsuleSkinDeleteResultDto( ) { public static CapsuleSkinDeleteResultDto fail() { - return new CapsuleSkinDeleteResultDto(CapsuleSkinDeleteResult.FAIL, "캡슐 스킨이 존재하지 않거나 캡슐에 사용되고 있습니다."); + return new CapsuleSkinDeleteResultDto(CapsuleSkinDeleteResult.FAIL, + "캡슐 스킨이 존재하지 않거나 캡슐에 사용되고 있습니다."); } public static CapsuleSkinDeleteResultDto success() { diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/repository/CapsuleSkinQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/repository/CapsuleSkinQueryRepositoryImpl.java index d4b1a4227..c95eef12e 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/repository/CapsuleSkinQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/repository/CapsuleSkinQueryRepositoryImpl.java @@ -59,7 +59,7 @@ public boolean existRelatedCapsule(final Long memberId, final Long capsuleSkinId Integer count = jpaQueryFactory .selectOne() .from(capsuleSkin) - .join(capsule).on(capsule.capsuleSkin.id.eq(capsuleSkin.id)) + .join(capsule).on(capsule.capsuleSkin.eq(capsuleSkin), capsuleSkin.deletedAt.isNull()) .where(capsuleSkin.id.eq(capsuleSkinId).and(capsuleSkin.member.id.eq(memberId)) .and(capsule.deletedAt.isNull())) .fetchOne(); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/service/CapsuleSkinService.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/service/CapsuleSkinService.java index 1395f74d3..fbe7ec286 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/service/CapsuleSkinService.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/capsuleskin/service/CapsuleSkinService.java @@ -81,12 +81,14 @@ public CapsuleSkinDeleteResultDto deleteCapsuleSkin( final Long memberId, final Long capsuleSkinId ) { - boolean existRelatedCapsule = capsuleSkinRepository.existRelatedCapsule(memberId, capsuleSkinId); + boolean existRelatedCapsule = capsuleSkinRepository.existRelatedCapsule(memberId, + capsuleSkinId); if (existRelatedCapsule) { return CapsuleSkinDeleteResultDto.fail(); } - CapsuleSkin capsuleSkin = capsuleSkinRepository.findCapsuleSkinByMemberIdAndId(memberId, capsuleSkinId) + CapsuleSkin capsuleSkin = capsuleSkinRepository.findCapsuleSkinByMemberIdAndId(memberId, + capsuleSkinId) .orElseThrow(CapsuleSkinNotFoundException::new); capsuleSkinRepository.delete(capsuleSkin); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/friend_invite/FriendInviteQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/friend_invite/FriendInviteQueryRepositoryImpl.java index 33e02694d..496fe671e 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/friend_invite/FriendInviteQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/friend_invite/FriendInviteQueryRepositoryImpl.java @@ -76,7 +76,7 @@ public Slice findFriendReceivingInvitesSlice( ) ) .from(friendInvite) - .join(friendInvite.owner, member) + .join(member).on(friendInvite.owner.eq(member), member.deletedAt.isNull()) .where(friendInvite.friend.id.eq(memberId).and(friendInvite.createdAt.lt(createdAt))) .limit(size + 1) .fetch(); @@ -101,7 +101,7 @@ public Slice findFriendSendingInvitesSlice( ) ) .from(friendInvite) - .join(friendInvite.owner, member) + .join(member).on(friendInvite.owner.eq(member), member.deletedAt.isNull()) .where(friendInvite.owner.id.eq(memberId).and(friendInvite.createdAt.lt(createdAt))) .limit(size + 1) .fetch(); diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java index f4cfbf8f6..79ce9c88b 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryImpl.java @@ -51,8 +51,8 @@ public Slice findFriendsSlice( ) ) .from(memberFriend) - .innerJoin(member).on(memberFriend.owner.id.eq(member.id)) - .innerJoin(member).on(memberFriend.friend.id.eq(member.id)) + .join(member).on(memberFriend.owner.eq(member), member.deletedAt.isNull()) + .join(member).on(memberFriend.friend.eq(member), member.deletedAt.isNull()) .where(memberFriend.owner.id.eq(memberId).and(memberFriend.createdAt.lt(createdAt))) .limit(size + 1) .fetch(); @@ -118,13 +118,16 @@ public List findFriendsByPhone( ) .from(member) .leftJoin(memberFriend) - .on(memberFriend.friend.id.eq(member.id).and(memberFriend.owner.id.eq(memberId))) + .on(memberFriend.friend.id.eq(member.id).and(memberFriend.owner.id.eq(memberId)), + memberFriend.deletedAt.isNull()) .leftJoin(friendInviteToFriend) .on(friendInviteToFriend.friend.id.eq(member.id) - .and(friendInviteToFriend.owner.id.eq(memberId))) + .and(friendInviteToFriend.owner.id.eq(memberId)), + friendInviteToFriend.deletedAt.isNull()) .leftJoin(friendInviteToMe) .on(friendInviteToMe.friend.id.eq(memberId) - .and(friendInviteToMe.owner.id.eq(member.id))) + .and(friendInviteToMe.owner.id.eq(member.id)), + friendInviteToMe.deletedAt.isNull()) .where(member.phoneHash.in(hashes).and(member.phoneSearchAvailable.eq(Boolean.TRUE))) .fetch(); } @@ -163,13 +166,16 @@ public Optional findFriendsByTag( ) .from(member) .leftJoin(memberFriend) - .on(memberFriend.friend.id.eq(member.id).and(memberFriend.owner.id.eq(memberId))) + .on(memberFriend.friend.id.eq(member.id).and(memberFriend.owner.id.eq(memberId)), + memberFriend.deletedAt.isNull()) .leftJoin(friendInviteToFriend) .on(friendInviteToFriend.friend.id.eq(member.id) - .and(friendInviteToFriend.owner.id.eq(memberId))) + .and(friendInviteToFriend.owner.id.eq(memberId)), + friendInviteToFriend.deletedAt.isNull()) .leftJoin(friendInviteToMe) .on(friendInviteToMe.owner.id.eq(member.id) - .and(friendInviteToMe.friend.id.eq(memberId))) + .and(friendInviteToMe.friend.id.eq(memberId)), + friendInviteToMe.deletedAt.isNull()) .where(tagFullTextSearchTemplate.gt(MATCH_THRESHOLD) .and(member.tagSearchAvailable.eq(Boolean.TRUE))) .orderBy(tagFullyMatchFirstOrder, tagFullTextSearchTemplate.desc()) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/group/repository/GroupQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/group/repository/GroupQueryRepositoryImpl.java index f01d8c9de..18ac63a38 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/group/repository/GroupQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/group/repository/GroupQueryRepositoryImpl.java @@ -47,7 +47,7 @@ public Slice findGroupSummaries( ) ) .from(memberGroup) - .join(memberGroup.group, group) + .join(group).on(memberGroup.group.eq(group), group.deletedAt.isNull()) .where(memberGroup.member.id.eq(memberId).and(memberGroup.createdAt.lt(createdAt))) .orderBy(group.id.desc()) .limit(size + 1) @@ -66,8 +66,8 @@ public List getGroupOwnerProfileUrls(final List groupIds) { return jpaQueryFactory .select(member.profileUrl) .from(memberGroup) - .join(memberGroup.group, group) - .join(memberGroup.member, member) + .join(group).on(memberGroup.group.eq(group), group.deletedAt.isNull()) + .join(member).on(memberGroup.member.eq(member), member.deletedAt.isNull()) .where(memberGroup.group.id.in(groupIds) .and(memberGroup.isOwner.eq(true))) .orderBy(group.id.desc()) @@ -98,8 +98,10 @@ public Optional findGroupDetailByGroupIdAndMemberId(final Long g GroupDetailDto groupDetailDtoIncludeMe = jpaQueryFactory .selectFrom(group) - .join(memberGroup).on(memberGroup.group.id.eq(group.id)) - .join(member).on(member.id.eq(memberGroup.member.id)) + .join(memberGroup).on(memberGroup.group.eq(group), + memberGroup.deletedAt.isNull()) + .join(member).on(member.eq(memberGroup.member), + member.deletedAt.isNull()) .where(group.id.eq(groupId)) .transform( groupBy(group.id).as( diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/entity/Member.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/entity/Member.java index 8e6c1a6fb..39067e754 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/entity/Member.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/entity/Member.java @@ -77,7 +77,7 @@ public class Member extends BaseEntity { private Boolean tagSearchAvailable = Boolean.TRUE; @Column(name = "phone_search_available", nullable = false) - private Boolean phoneSearchAvailable = Boolean.TRUE; + private Boolean phoneSearchAvailable = Boolean.FALSE; @Builder private Member(String profileUrl, String nickname, SocialType socialType, String email, diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/repository/MemberQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/repository/MemberQueryRepositoryImpl.java index c3d1b94a2..26d3e3699 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/repository/MemberQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member/repository/MemberQueryRepositoryImpl.java @@ -89,8 +89,10 @@ public Optional findMemberDetailResponseDtoById(final Long memb ) ) .from(member) - .leftJoin(memberFriend).on(member.id.eq(memberFriend.owner.id)) - .leftJoin(memberGroup).on(member.id.eq(memberGroup.member.id)) + .leftJoin(memberFriend).on(member.eq(memberFriend.owner), + memberFriend.deletedAt.isNull()) + .leftJoin(memberGroup).on(member.eq(memberGroup.member), + memberGroup.deletedAt.isNull()) .where(member.id.eq(memberId)) .groupBy(member.id) .fetchOne() diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java index 4305daacb..7d819e911 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/group_invite_repository/GroupInviteQueryRepositoryImpl.java @@ -96,8 +96,8 @@ public Slice findGroupReceivingInvitesSlice( ) ) .from(groupInvite) - .join(groupInvite.group, group) - .join(groupInvite.groupOwner, member) + .join(group).on(groupInvite.group.eq(group), group.deletedAt.isNull()) + .join(member).on(groupInvite.groupOwner.eq(member), member.deletedAt.isNull()) .where(groupInvite.groupMember.id.eq(memberId).and(groupInvite.createdAt.lt(createdAt))) .orderBy(groupInvite.id.desc()) .limit(size + 1) @@ -134,7 +134,7 @@ public Slice findGroupSendingInvites( ) ) .from(groupInvite) - .join(groupInvite.groupMember, member) + .join(member).on(groupInvite.groupMember.eq(member), member.deletedAt.isNull()) .where( groupInviteIdPagingCursorCondition(dto), groupInvite.group.id.eq(dto.groupId()) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/member_group_repository/MemberGroupQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/member_group_repository/MemberGroupQueryRepositoryImpl.java index c854b7453..d2877fd9c 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/member_group_repository/MemberGroupQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/member_group/repository/member_group_repository/MemberGroupQueryRepositoryImpl.java @@ -34,8 +34,8 @@ public Optional findOwnerInMemberGroup(final Long groupId, ) ) .from(memberGroup) - .join(memberGroup.member, member) - .join(memberGroup.group, group) + .join(member).on(memberGroup.member.eq(member), member.deletedAt.isNull()) + .join(group).on(memberGroup.group.eq(group), group.deletedAt.isNull()) .where(memberGroup.group.id.eq(groupId) .and(memberGroup.member.id.eq(memberId))) .fetchFirst() @@ -90,7 +90,7 @@ public List findGroupMemberInfos( ) ) .from(memberGroup) - .join(memberGroup.member, member) + .join(member).on(memberGroup.member.eq(member), member.deletedAt.isNull()) .where(memberGroup.group.id.eq(groupId)) .fetch(); } @@ -141,8 +141,9 @@ public List findGroupCapsuleMembers( ) ) .from(memberGroup) - .join(memberGroup.member, member) - .join(groupCapsuleOpen).on(memberGroup.member.id.eq(groupCapsuleOpen.member.id)) + .join(member).on(memberGroup.member.eq(member), member.deletedAt.isNull()) + .join(groupCapsuleOpen).on(memberGroup.member.id.eq(groupCapsuleOpen.member.id), + groupCapsuleOpen.deletedAt.isNull()) .where(memberGroup.group.id.eq(groupId).and(groupCapsuleOpen.capsule.id.eq(capsuleId))) .fetch(); } diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/domain/notification/repository/NotificationQueryRepositoryImpl.java b/backend/core/src/main/java/site/timecapsulearchive/core/domain/notification/repository/NotificationQueryRepositoryImpl.java index 3bb07446a..cc98d762e 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/domain/notification/repository/NotificationQueryRepositoryImpl.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/domain/notification/repository/NotificationQueryRepositoryImpl.java @@ -38,7 +38,9 @@ public Slice findNotificationSliceByMemberId( ) ) .from(notification) - .join(notification.notificationCategory, notificationCategory) + .join(notificationCategory) + .on(notification.notificationCategory.eq(notificationCategory), + notificationCategory.deletedAt.isNull()) .where(notification.createdAt.lt(createdAt).and(notification.member.id.eq(memberId))) .orderBy(notification.id.desc()) .limit(size + 1) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/SwaggerConfig.java b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/SwaggerConfig.java index 77fd165ac..328ce6815 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/SwaggerConfig.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/SwaggerConfig.java @@ -9,13 +9,11 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -// swagger 접속 url -> http://localhost:8080/api/swagger-ui/index.html#/ - @Configuration public class SwaggerConfig { @Bean - public OpenAPI springShopOpenAPI() { + public OpenAPI openApi() { return new OpenAPI() .servers(getServers()) .info(getInfo()) diff --git a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/rabbitmq/RabbitmqProperties.java b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/rabbitmq/RabbitmqProperties.java index a8e11e847..20ec38ac2 100644 --- a/backend/core/src/main/java/site/timecapsulearchive/core/global/config/rabbitmq/RabbitmqProperties.java +++ b/backend/core/src/main/java/site/timecapsulearchive/core/global/config/rabbitmq/RabbitmqProperties.java @@ -16,13 +16,14 @@ public record RabbitmqProperties( @NestedConfigurationProperty SSL ssl ) { + + public boolean isSslEnabled() { + return ssl != null && ssl.enabled; + } + protected record SSL( boolean enabled ) { } - - public boolean isSslEnabled() { - return ssl != null && ssl.enabled; - } } \ No newline at end of file diff --git a/backend/core/src/main/resources/db/migration/V34__drop_unique_owner_friend.sql b/backend/core/src/main/resources/db/migration/V34__drop_unique_owner_friend.sql new file mode 100644 index 000000000..f51be58a5 --- /dev/null +++ b/backend/core/src/main/resources/db/migration/V34__drop_unique_owner_friend.sql @@ -0,0 +1,29 @@ +-- friend_invite 외래 키 삭제 -> 유니크 키 삭제 -> 외래 키 추가 +ALTER TABLE friend_invite + DROP CONSTRAINT fk_friend_invite_owner_id; + +ALTER TABLE friend_invite + DROP CONSTRAINT fk_friend_invite_friend_id; + +ALTER TABLE friend_invite DROP KEY unique_owner_friend_pair; + +ALTER TABLE friend_invite + ADD CONSTRAINT fk_friend_invite_owner_id FOREIGN KEY (owner_id) REFERENCES member (member_id); + +ALTER TABLE friend_invite + ADD CONSTRAINT fk_friend_invite_friend_id FOREIGN KEY (friend_id) REFERENCES member (member_id); + +-- member_friend 외래 키 삭제 -> 유니크 키 삭제 -> 외래 키 추가 +ALTER TABLE member_friend + DROP CONSTRAINT fk_member_friend_owner_id; + +ALTER TABLE member_friend + DROP CONSTRAINT fk_member_friend_friend_id; + +ALTER TABLE member_friend DROP KEY unique_owner_friend_relation; + +ALTER TABLE member_friend + ADD CONSTRAINT fk_member_friend_owner_id FOREIGN KEY (owner_id) REFERENCES member (member_id); + +ALTER TABLE member_friend + ADD CONSTRAINT fk_member_friend_friend_id FOREIGN KEY (friend_id) REFERENCES member (member_id); \ No newline at end of file diff --git a/backend/core/src/main/resources/logback-spring.xml b/backend/core/src/main/resources/logback-spring.xml index f9ba2a0ca..4b25a32da 100644 --- a/backend/core/src/main/resources/logback-spring.xml +++ b/backend/core/src/main/resources/logback-spring.xml @@ -1,55 +1,34 @@ - - - http://10.0.0.8:3100/loki/api/v1/push - - - - - - { - "level":"%level", - "class":"%logger{36}", - "thread":"%thread", - "message": "%message", - "requestId": "%X{X-Request-ID}" - } - - - - - - - - %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + [%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{36} - %msg%n + + + + ./logs/info.log + + INFO + + + [%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{35} - %msg%n + + + ./logs/info.%d{yyyy-MM-dd}.%i.log.gz + + + 100MB + + 180 + - - - - - - - - - - - - - - + - + - - - - - + + \ No newline at end of file diff --git a/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryTest.java b/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryTest.java index 458e6d9a3..54c96d930 100644 --- a/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryTest.java +++ b/backend/core/src/test/java/site/timecapsulearchive/core/domain/friend/repository/member_friend/MemberFriendQueryRepositoryTest.java @@ -245,36 +245,6 @@ void clear(@Autowired EntityManager entityManager) { assertThat(friends).isEmpty(); } - @Test - void 사용자가_친구인_사용자로_주소록_기반_사용자_리스트_조회하면_친구인_앱_사용자_리스트가_나온다() { - //given - //when - List friends = memberFriendQueryRepository.findFriendsByPhone( - ownerId, - hashedFriendPhones); - - //then - assertSoftly(softly -> { - softly.assertThat(friends.size()).isSameAs(MAX_COUNT); - softly.assertThat(friends).allMatch(friend -> friend.isFriend() == Boolean.TRUE); - }); - } - - @Test - void 사용자가_친구가_아닌_사용자로_주소록_기반_사용자_리스트_조회하면_앱_사용자_리스트가_나온다() { - //given - //when - List friends = memberFriendQueryRepository.findFriendsByPhone( - ownerId, - hashedNotFriendPhones); - - //then - assertSoftly(softly -> { - assertThat(friends.size()).isSameAs(MAX_COUNT); - softly.assertThat(friends).allMatch(friend -> friend.isFriend() == Boolean.FALSE); - }); - } - @Test void 사용자가_빈_전화번호_목록으로_주소록_기반_사용자_리스트_조회하면_빈_리스트가_나온다() { //given diff --git a/backend/notification/src/main/resources/config b/backend/notification/src/main/resources/config index af9f352fc..1ee7ab86c 160000 --- a/backend/notification/src/main/resources/config +++ b/backend/notification/src/main/resources/config @@ -1 +1 @@ -Subproject commit af9f352fc1906f73672e340e7731c4352e270c59 +Subproject commit 1ee7ab86c074698d0e81ba783212e3cd08090a3d