Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: 서버 배포 #391

Merged
merged 37 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e882ad6
feat: Blacklist 성공, 실패 Type 구현 (#377)
its-sky Sep 6, 2024
745016d
feat: 블랙리스트 레포지토리 구현
penrose15 Sep 6, 2024
0386fb7
feat: 블랙리스트 조회 서비스 구현 (#380)
penrose15 Sep 6, 2024
71aea28
remove: 불필요한 파일 삭제 (#377)
its-sky Sep 6, 2024
dc359b8
feat: Blacklist 성공, 실패 Type 구현 (#377)
its-sky Sep 6, 2024
7c93cdf
feat: Blacklist Repository 및 Port 구현 (#377)
its-sky Sep 6, 2024
8b5bde9
feat: 사용자 차단 API 및 Service 구현 (#377)
its-sky Sep 6, 2024
7c17b2c
feat: Blacklist Swagger 추가 (#377)
its-sky Sep 6, 2024
f2e1dd3
chore: 코드리뷰 반영 (#377)
its-sky Sep 6, 2024
5fb4f35
Merge pull request #382 from depromeet/feature/377-blacklist
its-sky Sep 6, 2024
bb07c28
chore: Memory Delete Logging 어노테이션 추가 (#383)
its-sky Sep 6, 2024
2662225
feat: 사용자 차단 해제 API 구현 (#383)
its-sky Sep 6, 2024
2685ded
feat: 사용자 차단 해제 API Swagger 추가 (#383)
its-sky Sep 6, 2024
27c0e49
Merge pull request #384 from depromeet/feature/383-unblack
its-sky Sep 6, 2024
b312f51
feat: 팔로우/팔로잉 조회시 차단한 유저/본인을 차단한 사람 리스트에서 제외 (#379)
penrose15 Sep 6, 2024
a917e22
feat: 컨플릭트 해결
penrose15 Sep 6, 2024
0618637
feat: 컨플릭트 해결
penrose15 Sep 6, 2024
07a9548
feat: 신고 스프레드시트 환경변수 추가 및 연동 구현 (#378)
ywonchae1 Sep 6, 2024
301e391
Merge branch 'develop' of https://github.com/depromeet/15th-team2-BE …
penrose15 Sep 6, 2024
d7d51bd
Merge branch 'develop' into feature/379-followlist-invisible
penrose15 Sep 6, 2024
eb1feaa
feat: 신고 타입 추가 (#378)
ywonchae1 Sep 6, 2024
ba37bfe
feat: 신고 기능 구현 (#378)
ywonchae1 Sep 6, 2024
c097962
feat: 신고 기능 시 조회 최적화 메서드 추가 (#378)
ywonchae1 Sep 6, 2024
987129b
test: 테스트코드 구현 (#378)
ywonchae1 Sep 6, 2024
abaf7dd
feat: 자신의 기록에 신고 불가능 기능 구현 (#378)
ywonchae1 Sep 6, 2024
ba684e0
test: 테스트 오류 해결
penrose15 Sep 6, 2024
309aa75
feat: 코드리뷰 반영 (#379)
penrose15 Sep 6, 2024
c47e0ba
chore: 메서드 간소화 (#378)
ywonchae1 Sep 6, 2024
b6015ae
fix: 입력 값 검증 추가 (#378)
ywonchae1 Sep 6, 2024
537a67c
Merge pull request #388 from depromeet/feature/378-report-google-spre…
ywonchae1 Sep 6, 2024
d1a2fa3
Merge pull request #386 from depromeet/feature/379-followlist-invisible
penrose15 Sep 6, 2024
df8e406
feat: 차단한 사용자 조회 API 구현 (#385)
its-sky Sep 6, 2024
c547880
feat: 차단한 사용자 조회 API Swagger 추가 (#385)
its-sky Sep 6, 2024
f4dfc18
merge: 충돌 해결 (#385)
its-sky Sep 6, 2024
2cf3012
refactor: 차단 API 자신은 차단하지 못하도록 변경 (#385)
its-sky Sep 6, 2024
0677c3b
refactor: 유저 프로필 이미지 URL 조회 방식 변경 (#385)
its-sky Sep 6, 2024
fdc0208
Merge pull request #390 from depromeet/feature/385-get-black
its-sky Sep 6, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.depromeet.blacklist.domain.vo;

import com.depromeet.member.domain.Member;
import java.util.List;

public record BlacklistPage(List<Member> blackMembers, boolean hasNext, Long cursorId) {
public static BlacklistPage of(List<Member> blackMembers, boolean hasNext, Long nextCursorId) {
return new BlacklistPage(blackMembers, hasNext, nextCursorId);
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.depromeet.blacklist.port.in.usecase;

import com.depromeet.blacklist.domain.Blacklist;

public interface BlacklistCommandUseCase {
Blacklist blackMember(Long memberId, Long blackMemberId);

void unblackMember(Long memberId, Long blackMemberId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.depromeet.blacklist.port.in.usecase;

import com.depromeet.blacklist.domain.vo.BlacklistPage;
import java.util.Set;

public interface BlacklistQueryUseCase {
boolean checkBlackMember(Long memberId, Long blackMemberId);

BlacklistPage getBlackMembers(Long memberId, Long cursorId);

Set<Long> getBlackMemberIds(Long memberId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.depromeet.blacklist.port.out.persistence;

import com.depromeet.blacklist.domain.Blacklist;
import com.depromeet.member.domain.Member;
import java.util.List;

public interface BlacklistPersistencePort {
Blacklist save(Blacklist blacklist);

boolean existsByMemberIdAndBlackMemberId(Long memberId, Long blackMemberId);

void unblackMember(Long memberId, Long blackMemberId);

List<Member> findBlackMembers(Long memberId, Long cursorId);

List<Long> findBlackMemberIdsByMemberId(Long memberId);

List<Long> findMemberIdsWhoBlockedMe(Long memberId);
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.depromeet.blacklist.service;

import com.depromeet.blacklist.domain.Blacklist;
import com.depromeet.blacklist.domain.vo.BlacklistPage;
import com.depromeet.blacklist.port.in.usecase.BlacklistCommandUseCase;
import com.depromeet.blacklist.port.in.usecase.BlacklistQueryUseCase;
import com.depromeet.blacklist.port.out.persistence.BlacklistPersistencePort;
import com.depromeet.member.domain.Member;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class BlacklistService implements BlacklistQueryUseCase, BlacklistCommandUseCase {
private final BlacklistPersistencePort blacklistPersistencePort;

@Override
@Transactional
public Blacklist blackMember(Long memberId, Long blackMemberId) {
return blacklistPersistencePort.save(
Blacklist.builder()
.member(Member.builder().id(memberId).build())
.blackMember(Member.builder().id(blackMemberId).build())
.build());
}

@Override
@Transactional
public void unblackMember(Long memberId, Long blackMemberId) {
blacklistPersistencePort.unblackMember(memberId, blackMemberId);
}

@Override
public boolean checkBlackMember(Long memberId, Long blackMemberId) {
return blacklistPersistencePort.existsByMemberIdAndBlackMemberId(memberId, blackMemberId);
}

@Override
public BlacklistPage getBlackMembers(Long memberId, Long cursorId) {
List<Member> blackMembers = blacklistPersistencePort.findBlackMembers(memberId, cursorId);
boolean hasNext = false;
Long nextCursorId = null;
if (blackMembers != null && blackMembers.size() > 10) {
hasNext = true;
Member member = blackMembers.removeLast();
nextCursorId = member.getId();
}
return BlacklistPage.of(blackMembers, hasNext, nextCursorId);
}

@Override
public Set<Long> getBlackMemberIds(Long memberId) {
List<Long> blackMemberIds = getBlackMemberIdsByMemberId(memberId);
List<Long> memberIdsWhoBlockedMe = getMemberIdsWhoBlockedMe(memberId);

blackMemberIds.addAll(memberIdsWhoBlockedMe);

return new HashSet<>(blackMemberIds);
}

private List<Long> getBlackMemberIdsByMemberId(Long memberId) {
return blacklistPersistencePort.findBlackMemberIdsByMemberId(memberId);
}

private List<Long> getMemberIdsWhoBlockedMe(Long memberId) {
return blacklistPersistencePort.findMemberIdsWhoBlockedMe(memberId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
@NoArgsConstructor
public class FollowSlice<T> {
private List<T> followContents;
private int pageSize;
private Long cursorId;
private boolean hasNext;

@Builder
public FollowSlice(List<T> followContents, int pageSize, Long cursorId, boolean hasNext) {
public FollowSlice(List<T> followContents, Long cursorId, boolean hasNext) {
this.followContents = followContents != null ? followContents : new ArrayList<>();
this.pageSize = pageSize != 0 ? pageSize : 10;
this.cursorId = cursorId;
this.hasNext = hasNext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public interface FriendPersistencePort {

void deleteByMemberIdAndFollowingId(Long memberId, Long followingId);

FollowSlice<Following> findFollowingsByMemberIdAndCursorId(Long memberId, Long cursorId);
List<Following> findFollowingsByMemberIdAndCursorId(Long memberId, Long cursorId);

FollowSlice<Follower> findFollowersByMemberIdAndCursorId(Long memberId, Long cursorId);
List<Follower> findFollowersByMemberIdAndCursorId(Long memberId, Long cursorId);

int countFollowingByMemberId(Long memberId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.depromeet.friend.port.out.persistence.FriendPersistencePort;
import com.depromeet.member.domain.Member;
import com.depromeet.type.friend.FollowErrorType;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -39,12 +40,42 @@ public boolean addOrDeleteFollow(Member member, Member following) {

@Override
public FollowSlice<Following> getFollowingByMemberIdAndCursorId(Long memberId, Long cursorId) {
return friendPersistencePort.findFollowingsByMemberIdAndCursorId(memberId, cursorId);
List<Following> followings =
friendPersistencePort.findFollowingsByMemberIdAndCursorId(memberId, cursorId);

boolean hasNext = false;
Long nextCursorId = null;
if (followings.size() > 10) {
followings = new ArrayList<>(followings);
followings.removeLast();
hasNext = true;
nextCursorId = followings.getLast().getFriendId();
}
return FollowSlice.<Following>builder()
.followContents(followings)
.cursorId(nextCursorId)
.hasNext(hasNext)
.build();
}

@Override
public FollowSlice<Follower> getFollowerByMemberIdAndCursorId(Long memberId, Long cursorId) {
return friendPersistencePort.findFollowersByMemberIdAndCursorId(memberId, cursorId);
List<Follower> followers =
friendPersistencePort.findFollowersByMemberIdAndCursorId(memberId, cursorId);

boolean hasNext = false;
Long nextCursorId = null;
if (followers.size() > 10) {
followers = new ArrayList<>(followers);
followers.removeLast();
hasNext = true;
nextCursorId = followers.getLast().getFriendId();
}
return FollowSlice.<Follower>builder()
.followContents(followers)
.cursorId(nextCursorId)
.hasNext(hasNext)
.build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public Member(
this.lastViewedFollowingLogAt = lastViewedFollowingLogAt;
}

public Member(Long id, String nickname, String profileImageUrl, String introduction) {
this.id = id;
this.nickname = nickname;
this.profileImageUrl = profileImageUrl;
this.introduction = introduction;
}

public Member updateGoal(Integer goal) {
this.goal = goal;
return this;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.depromeet.member.domain.vo;

public record MemberIdAndNickname(Long id, String nickname) {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.depromeet.member.port.in.usecase;

import com.depromeet.member.domain.Member;
import com.depromeet.member.domain.vo.MemberIdAndNickname;
import com.depromeet.member.domain.vo.MemberSearchPage;
import com.depromeet.member.port.in.command.SocialMemberCommand;

Expand All @@ -16,4 +17,6 @@ public interface MemberUseCase {
Member findByProviderId(String providerId);

Member createMemberBy(SocialMemberCommand command);

MemberIdAndNickname findIdAndNicknameById(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.depromeet.member.domain.Member;
import com.depromeet.member.domain.MemberGender;
import com.depromeet.member.domain.vo.MemberIdAndNickname;
import com.depromeet.member.domain.vo.MemberSearchPage;
import com.depromeet.member.port.in.command.UpdateMemberCommand;
import java.util.Optional;
Expand Down Expand Up @@ -30,4 +31,6 @@ public interface MemberPersistencePort {
Optional<Member> update(UpdateMemberCommand command);

Optional<Member> updateProfileImageUrl(Long memberId, String profileImageUrl);

Optional<MemberIdAndNickname> findIdAndNicknameById(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.depromeet.member.domain.Member;
import com.depromeet.member.domain.MemberGender;
import com.depromeet.member.domain.MemberRole;
import com.depromeet.member.domain.vo.MemberIdAndNickname;
import com.depromeet.member.domain.vo.MemberSearchPage;
import com.depromeet.member.port.in.command.SocialMemberCommand;
import com.depromeet.member.port.in.command.UpdateMemberCommand;
Expand Down Expand Up @@ -82,6 +83,13 @@ public Member createMemberBy(SocialMemberCommand command) {
return memberPersistencePort.save(member);
}

@Override
public MemberIdAndNickname findIdAndNicknameById(Long memberId) {
return memberPersistencePort
.findIdAndNicknameById(memberId)
.orElseThrow(() -> new NotFoundException(MemberErrorType.NOT_FOUND));
}

@Override
public Member update(UpdateMemberCommand command) {
if (command.nickname() != null && command.nickname().isBlank()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.depromeet.memory.domain.vo;

import com.depromeet.member.domain.vo.MemberIdAndNickname;

public record MemoryIdAndDiaryAndMember(Long id, String diary, MemberIdAndNickname member) {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.depromeet.memory.domain.Memory;
import com.depromeet.memory.domain.vo.MemoryAndDetailId;
import com.depromeet.memory.domain.vo.MemoryIdAndDiaryAndMember;
import com.depromeet.memory.domain.vo.MemoryInfo;
import java.util.List;

Expand All @@ -17,4 +18,6 @@ public interface GetMemoryUseCase {
MemoryInfo findByIdWithPrevNext(Long requestMemberId, Long memoryId);

MemoryAndDetailId findMemoryAndDetailIdsByMemberId(Long memberId);

MemoryIdAndDiaryAndMember findIdAndNicknameById(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.depromeet.memory.domain.Memory;
import com.depromeet.memory.domain.vo.MemoryAndDetailId;
import com.depromeet.memory.domain.vo.MemoryIdAndDiaryAndMember;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -36,4 +37,6 @@ public interface MemoryPersistencePort {
MemoryAndDetailId findMemoryAndDetailIdsByMemberId(Long memberId);

void deleteById(Long memoryId);

Optional<MemoryIdAndDiaryAndMember> findIdAndNicknameById(Long memberId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.depromeet.memory.domain.MemoryDetail;
import com.depromeet.memory.domain.Stroke;
import com.depromeet.memory.domain.vo.MemoryAndDetailId;
import com.depromeet.memory.domain.vo.MemoryIdAndDiaryAndMember;
import com.depromeet.memory.domain.vo.MemoryInfo;
import com.depromeet.memory.port.in.command.CreateMemoryCommand;
import com.depromeet.memory.port.in.command.UpdateMemoryCommand;
Expand Down Expand Up @@ -110,6 +111,13 @@ public MemoryAndDetailId findMemoryAndDetailIdsByMemberId(Long memberId) {
return memoryPersistencePort.findMemoryAndDetailIdsByMemberId(memberId);
}

@Override
public MemoryIdAndDiaryAndMember findIdAndNicknameById(Long memberId) {
return memoryPersistencePort
.findIdAndNicknameById(memberId)
.orElseThrow(() -> new NotFoundException(MemoryErrorType.NOT_FOUND));
}

@Override
@Transactional
public Memory update(Long memoryId, UpdateMemoryCommand command, List<Stroke> strokes) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.depromeet.report.domain;

import com.depromeet.converter.AbstractCodedEnumConverter;
import com.depromeet.converter.CodedEnum;

public enum ReportReasonCode implements CodedEnum<String> {
REPORT_REASON_1("스팸, 광고"),
REPORT_REASON_2("폭력적인 발언"),
REPORT_REASON_3("음란성, 선정 내용"),
REPORT_REASON_4("개인정보 노출"),
REPORT_REASON_5("주제와 무관");

private String value;

ReportReasonCode(String value) {
this.value = value;
}

@Override
public String getValue() {
return this.value;
}

@jakarta.persistence.Converter(autoApply = true)
static class Converter extends AbstractCodedEnumConverter<ReportReasonCode, String> {
public Converter() {
super(ReportReasonCode.class);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.depromeet.report.port.in.command;

import com.depromeet.image.domain.Image;
import com.depromeet.member.domain.vo.MemberIdAndNickname;
import com.depromeet.memory.domain.vo.MemoryIdAndDiaryAndMember;
import com.depromeet.report.domain.ReportReasonCode;
import java.util.List;

public record CreateReportCommand(
MemberIdAndNickname member,
MemoryIdAndDiaryAndMember reportMemory,
List<Image> images,
ReportReasonCode reasonCode) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.depromeet.report.port.in.usecase;

import com.depromeet.report.port.in.command.CreateReportCommand;

public interface CreateReportUseCase {
void save(CreateReportCommand command);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.depromeet.report.port.out.persistence;

import com.depromeet.report.port.in.command.CreateReportCommand;

public interface ReportPersistencePort {
void writeReportToSheet(CreateReportCommand command);
}
Loading