From 9f1b65e5c67c61593ce5146b948685b57fcb74eb Mon Sep 17 00:00:00 2001 From: minsu20 Date: Sat, 27 Jan 2024 16:11:47 +0900 Subject: [PATCH] =?UTF-8?q?deploy:=20build=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AlarmHistoryCustomRepository.java | 2 -- .../AlarmHistoryCustomRepositoryImpl.java | 27 +++-------------- .../service/AlarmHistoryGetService.java | 8 ----- .../domain/service/MemberCheckService.java | 18 ------------ .../domain/service/MemberDeleteService.java | 20 ------------- .../domain/service/MemberGetService.java | 8 ----- .../domain/service/MemberSaveService.java | 29 ------------------- .../service/ApproveTeamUseCase.java | 2 ++ 8 files changed, 6 insertions(+), 108 deletions(-) delete mode 100644 backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberCheckService.java delete mode 100644 backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberDeleteService.java delete mode 100644 backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberSaveService.java diff --git a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepository.java b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepository.java index 95a4a34..cd5c06e 100644 --- a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepository.java +++ b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepository.java @@ -6,7 +6,5 @@ public interface AlarmHistoryCustomRepository { - List findAlarmHistoriesByMemberId(Long memberId); - String findUnreadAlarmCount(Long memberId); } diff --git a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepositoryImpl.java b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepositoryImpl.java index 68708cc..9bf0ada 100644 --- a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepositoryImpl.java +++ b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/repository/AlarmHistoryCustomRepositoryImpl.java @@ -1,13 +1,11 @@ package com.moing.bo.backend.domain.history.domain.repository; -import com.moing.backend.domain.history.application.dto.response.GetAlarmHistoryResponse; -import com.moing.backend.domain.history.application.dto.response.QGetAlarmHistoryResponse; +import com.moing.bo.backend.domain.history.application.dto.response.GetAlarmHistoryResponse; +import com.moing.bo.backend.domain.history.application.dto.response.QGetAlarmHistoryResponse; import com.querydsl.jpa.impl.JPAQueryFactory; +import jakarta.persistence.EntityManager; -import javax.persistence.EntityManager; -import java.util.List; - -import static com.moing.backend.domain.history.domain.entity.QAlarmHistory.alarmHistory; +import static com.moing.bo.backend.domain.history.domain.entity.QAlarmHistory.alarmHistory; public class AlarmHistoryCustomRepositoryImpl implements AlarmHistoryCustomRepository { @@ -17,23 +15,6 @@ public AlarmHistoryCustomRepositoryImpl(EntityManager em) { this.queryFactory = new JPAQueryFactory(em); } - @Override - public List findAlarmHistoriesByMemberId(Long memberId) { - return queryFactory.select(new QGetAlarmHistoryResponse(alarmHistory.id, - alarmHistory.type, - alarmHistory.path, - alarmHistory.idInfo, - alarmHistory.title, - alarmHistory.body, - alarmHistory.name, - alarmHistory.isRead, - alarmHistory.createdDate)) - .from(alarmHistory) - .where(alarmHistory.receiverId.eq(memberId)) - .orderBy(alarmHistory.createdDate.desc()) - .fetch(); - } - @Override public String findUnreadAlarmCount(Long memberId) { Long count = queryFactory.select(alarmHistory.count()) diff --git a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/service/AlarmHistoryGetService.java b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/service/AlarmHistoryGetService.java index 806a4c6..feeceb7 100644 --- a/backend/src/main/java/com/moing/bo/backend/domain/history/domain/service/AlarmHistoryGetService.java +++ b/backend/src/main/java/com/moing/bo/backend/domain/history/domain/service/AlarmHistoryGetService.java @@ -17,14 +17,6 @@ public class AlarmHistoryGetService { private final AlarmHistoryRepository alarmHistoryRepository; - public List getAlarmHistories(Long memberId) { - return alarmHistoryRepository.findAlarmHistoriesByMemberId(memberId); - } - - public AlarmHistory getAlarmHistory(Long alarmHistoryId, Long memberId) { - return alarmHistoryRepository.findAlarmHistoryByIdAndReceiverId(alarmHistoryId, memberId).orElseThrow(NotFoundAlarmHistoryException::new); - } - public String getUnreadAlarmCount(Long memberId) { return alarmHistoryRepository.findUnreadAlarmCount(memberId); } diff --git a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberCheckService.java b/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberCheckService.java deleted file mode 100644 index 1b4a97d..0000000 --- a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberCheckService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.moing.bo.backend.domain.member.domain.service; - -import com.moing.backend.domain.member.domain.repository.MemberRepository; -import com.moing.backend.global.annotation.DomainService; -import lombok.RequiredArgsConstructor; - -import javax.transaction.Transactional; - -@DomainService -@Transactional -@RequiredArgsConstructor -public class MemberCheckService { - private final MemberRepository memberRepository; - public boolean checkNickname(String nickname) { - return memberRepository.checkNickname(nickname); - } - -} diff --git a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberDeleteService.java b/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberDeleteService.java deleted file mode 100644 index 3b2d7bc..0000000 --- a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberDeleteService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.moing.bo.backend.domain.member.domain.service; - -import com.moing.backend.domain.member.domain.entity.Member; -import com.moing.backend.domain.member.domain.repository.MemberRepository; -import com.moing.backend.global.annotation.DomainService; -import lombok.RequiredArgsConstructor; - -import javax.transaction.Transactional; - -@DomainService -@Transactional -@RequiredArgsConstructor -public class MemberDeleteService { - - private final MemberRepository memberRepository; - - public void deleteMember(Member member){ - this.memberRepository.delete(member); - } -} diff --git a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberGetService.java b/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberGetService.java index c44fdc0..cb9db46 100644 --- a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberGetService.java +++ b/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberGetService.java @@ -1,6 +1,5 @@ package com.moing.bo.backend.domain.member.domain.service; -import com.moing.bo.backend.domain.member.domain.entity.Member; import com.moing.bo.backend.domain.member.domain.repository.MemberRepository; import com.moing.bo.backend.global.annotation.DomainService; import jakarta.transaction.Transactional; @@ -12,11 +11,4 @@ public class MemberGetService { private final MemberRepository memberRepository; - public Member getMemberBySocialId(String socialId) { - return memberRepository.findNotDeletedBySocialId(socialId).orElseThrow(() -> new NotFoundBySocialIdException()); - } - - public Member getMemberByMemberId(Long memberId) { - return memberRepository.findNotDeletedByMemberId(memberId).orElseThrow(() -> new NotFoundBySocialIdException()); - } } diff --git a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberSaveService.java b/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberSaveService.java deleted file mode 100644 index 840e62e..0000000 --- a/backend/src/main/java/com/moing/bo/backend/domain/member/domain/service/MemberSaveService.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.moing.bo.backend.domain.member.domain.service; - -import com.moing.backend.domain.member.domain.entity.Member; -import com.moing.backend.domain.member.domain.repository.MemberRepository; -import com.moing.backend.global.annotation.DomainService; -import lombok.AllArgsConstructor; - -import javax.transaction.Transactional; -import java.time.LocalDateTime; -import java.util.Optional; - -@DomainService -@Transactional -@AllArgsConstructor -public class MemberSaveService { - - private final MemberRepository memberRepository; - - public Member saveMember(Member member) { - OptionalfindMember=memberRepository.findNotDeletedBySocialId(member.getSocialId()); - if(findMember.isEmpty()){ - return memberRepository.save(member); - } else { - findMember.get().updateFcmToken(member.getFcmToken()); - findMember.get().updateLastSignInTime(LocalDateTime.now()); - return findMember.get(); - } - } -} diff --git a/backend/src/main/java/com/moing/bo/backend/domain/team/application/service/ApproveTeamUseCase.java b/backend/src/main/java/com/moing/bo/backend/domain/team/application/service/ApproveTeamUseCase.java index 2d127d4..7b93a4a 100644 --- a/backend/src/main/java/com/moing/bo/backend/domain/team/application/service/ApproveTeamUseCase.java +++ b/backend/src/main/java/com/moing/bo/backend/domain/team/application/service/ApproveTeamUseCase.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; import static com.moing.bo.backend.domain.history.domain.entity.PagePath.HOME_PATH; import static com.moing.bo.backend.global.config.fcm.constant.ApproveTeamMessage.APPROVE_TEAM_MESSAGE; @@ -32,6 +33,7 @@ public void approveTeams(List teamIds) { for (GetLeaderInfoResponse info : leaderInfos) { String title = APPROVE_TEAM_MESSAGE.title(info.getLeaderName(), info.getTeamName()); String body = APPROVE_TEAM_MESSAGE.body(); + saveAlarmHistoryUseCase.saveAlarmHistory(info.getLeaderId(), "", title, body, info.getTeamName(), AlarmType.APPROVE_TEAM, HOME_PATH.getValue()); fcmService.sendSingleDevice(new SingleRequest(info.getLeaderFcmToken(), title, body)); }