Skip to content

Commit

Permalink
Merge pull request #610 from tukcomCD2024/develop_back_core
Browse files Browse the repository at this point in the history
feat : merge develop -> prod
  • Loading branch information
seokho-1116 authored Aug 4, 2024
2 parents 249eeda + 6626c8a commit 3a18bd1
Show file tree
Hide file tree
Showing 28 changed files with 174 additions and 171 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/core-application-prod-ci-cd-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core-application-test-ci-cd-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

backend/data

backend/docker-volumes

.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import site.timecapsulearchive.core.global.common.response.ApiSpec;

public interface AnnouncementApi {

@Operation(
summary = "공지사항 페이지",
description = "모든 공지사항을 가져온다. 최신 공지가 리스트의 맨 처음에 위치한다.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ public List<NearbyARCapsuleSummaryDto> 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();
Expand Down Expand Up @@ -114,8 +115,6 @@ public List<NearbyCapsuleSummaryDto> findCapsuleSummaryDtosByCurrentLocationAndC
)
)
.from(capsule)
.join(capsule.capsuleSkin, capsuleSkin)
.join(capsule.member, member)
.where(
ST_Contains(mbr, capsule.point).and(capsuleFilter(capsuleType, memberId, groupIds)))
.fetch();
Expand Down Expand Up @@ -143,8 +142,6 @@ public List<NearbyCapsuleSummaryDto> 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();
Expand Down Expand Up @@ -181,8 +178,9 @@ public List<NearbyARCapsuleSummaryDto> 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();
Expand All @@ -201,7 +199,8 @@ public Optional<TreasureCapsuleSummaryDto> 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()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ResponseEntity<ApiSpec<GroupCapsuleSliceResponse>> getGroupCapsules(
@Max(value = 40, message = "최대 페이징 크기는 40입니다.")
int size,

@Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디", required = true)
@Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디")
Long lastCapsuleId
);

Expand Down Expand Up @@ -151,7 +151,7 @@ ResponseEntity<ApiSpec<GroupSpecificCapsuleSliceResponse>> getGroupSpecificCapsu
@Parameter(in = ParameterIn.QUERY, description = "페이지 크기", required = true)
int size,

@Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디", required = true)
@Parameter(in = ParameterIn.QUERY, description = "마지막 캡슐 아이디")
Long lastCapsuleId
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public List<GroupCapsuleMemberDto> 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))
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -63,10 +60,11 @@ public Optional<GroupCapsuleDetailDto> 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()
);
Expand Down Expand Up @@ -101,9 +99,10 @@ public Optional<GroupCapsuleSummaryDto> 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))
)
Expand All @@ -130,8 +129,9 @@ public Slice<CapsuleBasicInfoDto> 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)))
Expand Down Expand Up @@ -222,11 +222,12 @@ public Slice<GroupCapsuleDto> 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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ public Optional<PublicCapsuleDetailDto> 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();
Expand Down Expand Up @@ -118,10 +119,11 @@ public Optional<PublicCapsuleSummaryDto> 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)
Expand Down Expand Up @@ -167,10 +169,11 @@ public Slice<PublicCapsuleDetailDto> 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)))
Expand Down Expand Up @@ -202,8 +205,9 @@ public Slice<CapsuleBasicInfoDto> 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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ public Optional<CapsuleDetailDto> 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))
Expand Down Expand Up @@ -122,7 +123,8 @@ public Slice<CapsuleBasicInfoDto> 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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Slice<FriendSummaryDto> 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();
Expand All @@ -101,7 +101,7 @@ public Slice<FriendSummaryDto> 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();
Expand Down
Loading

0 comments on commit 3a18bd1

Please sign in to comment.