Skip to content

Commit

Permalink
delete(activityNotification): 필요없는 클래스 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
ehBeak committed Dec 26, 2023
1 parent e8850b8 commit ff54f93
Show file tree
Hide file tree
Showing 18 changed files with 2 additions and 381 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,21 @@
import com.connect.accountApp.domain.activitynotification.adapter.out.persistence.jpa.model.ActivityNotificationJpaEntity;
import com.connect.accountApp.domain.activitynotification.application.port.in.command.ActivityNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.out.FindActivityNotificationsPort;
import com.connect.accountApp.domain.activitynotification.application.port.out.FindExpenseNotificationPort;
import com.connect.accountApp.domain.activitynotification.application.port.out.SaveActivityNotificationPort;
import com.connect.accountApp.domain.activitynotification.application.port.out.command.FindExpenseNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.out.command.NotificationCommand;
import com.connect.accountApp.domain.activitynotification.domain.model.ActivityNotification;
import com.connect.accountApp.domain.activitynotification.exception.ActivityNotificationNotFoundException;
import com.connect.accountApp.domain.usernotification.adapter.port.out.persistence.jpa.UserActivityNotificationJpaRepository;
import com.connect.accountApp.domain.usernotification.adapter.port.out.persistence.UserActivityNotificationMapper;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class ActivityNotificationPersistenceAdapter implements FindActivityNotificationsPort,
FindExpenseNotificationPort, SaveActivityNotificationPort {
public class ActivityNotificationPersistenceAdapter implements FindActivityNotificationsPort, SaveActivityNotificationPort {

private final NotificationQueryRepository notificationQueryRepository;
private final ActivityNotificationJpaRepository activityNotificationJpaRepository;
private final ActivityNotificationMapper activityNotificationMapper;

@Override
public List<NotificationCommand> findActivityNotifications(Long userId) {
return notificationQueryRepository.findActivityNotifications(userId);
}

@Override
public ActivityNotification findUserActivityNotification(Long activityNotificationId) {
ActivityNotificationJpaEntity activityNotificationJpaEntity = activityNotificationJpaRepository.findById(
Expand Down Expand Up @@ -66,12 +54,6 @@ public ActivityNotification findActivityNotification(Long activityNotificationId
return activityNotificationMapper.mapToDomainEntity(activityNotificationJpaEntity);
}


@Override
public List<FindExpenseNotificationCommand> findExpenseNotification(Long userId) {
return notificationQueryRepository.findExpenseNotifications(userId);
}

@Override
public Long saveActivityNotification(ActivityNotification activityNotification) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
package com.connect.accountApp.domain.activitynotification.adapter.out.persistence;

import static com.connect.accountApp.domain.activitynotification.adapter.out.persistence.jpa.model.QActivityNotificationJpaEntity.activityNotificationJpaEntity;
import static com.connect.accountApp.domain.expense.adapter.out.persistence.jpa.model.QExpenseJpaEntity.expenseJpaEntity;
import static com.connect.accountApp.domain.usernotification.adapter.port.out.persistence.jpa.model.QUserActivityNotificationJpaEntity.userActivityNotificationJpaEntity;

import com.connect.accountApp.domain.activitynotification.adapter.out.persistence.jpa.model.ActivityNotificationJpaEntity;
import com.connect.accountApp.domain.activitynotification.application.port.in.command.ActivityNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.out.command.FindExpenseNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.out.command.NotificationCommand;
import com.connect.accountApp.domain.activitynotification.domain.model.ActivityNotification;
import com.connect.accountApp.domain.activitynotification.domain.model.NotiCategory;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import lombok.RequiredArgsConstructor;
Expand All @@ -25,48 +19,6 @@ public class NotificationQueryRepository {

private final JPAQueryFactory jpaQueryFactory;

public List<NotificationCommand> findActivityNotifications(Long userId) {

return jpaQueryFactory
.select(Projections.constructor(NotificationCommand.class,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.activityNotificationId,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.createdAt,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.activityNotificationCategory,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.message,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.isRead,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.title
))
.from(userActivityNotificationJpaEntity)
.join(userActivityNotificationJpaEntity.activityNotificationJpaEntity, activityNotificationJpaEntity)
.where(
eqUserId(userId),
notInNotiCategory(NotiCategory.ACCEPT_INVITATION) // 지출이 아닌 것
)
.orderBy(userActivityNotificationJpaEntity.activityNotificationJpaEntity.createdAt.desc())
.fetch();
}


public List<FindExpenseNotificationCommand> findExpenseNotifications(Long userId) {

return jpaQueryFactory
.select(Projections.constructor(FindExpenseNotificationCommand.class,
expenseJpaEntity.expenseCategory.as("category"), // 카테고리
userActivityNotificationJpaEntity.activityNotificationJpaEntity.createdAt.as("createdAt"),
userActivityNotificationJpaEntity.activityNotificationJpaEntity.isRead,
expenseJpaEntity.expenseAmount,
userActivityNotificationJpaEntity.activityNotificationJpaEntity.title
))
.from(userActivityNotificationJpaEntity)
.join(userActivityNotificationJpaEntity.activityNotificationJpaEntity, activityNotificationJpaEntity)
// .join(notificationJpaEntity.expenseJpaEntity, expenseJpaEntity)
.where(
eqUserId(userId),
eqNotiCategory(NotiCategory.ACCEPT_INVITATION)
)
.orderBy(userActivityNotificationJpaEntity.activityNotificationJpaEntity.createdAt.desc())
.fetch();
}

public List<ActivityNotificationCommand> findActivityNotifications(String userEmail) {

Expand Down Expand Up @@ -103,19 +55,4 @@ public List<ActivityNotificationJpaEntity> findActivityNotificationByBill(List<L
.fetch();
}


private BooleanExpression eqUserId(Long userId) {
log.info("[NotificationQueryRepository] userId : {}", userId);
return userId != null ? userActivityNotificationJpaEntity.userJpaEntity.userId.eq(userId) : null;
}

private BooleanExpression notInNotiCategory(NotiCategory notiCategory) {
log.info("[NotificationQueryRepository] notiCategory : {}", notiCategory);
return notiCategory != null ? userActivityNotificationJpaEntity.activityNotificationJpaEntity.activityNotificationCategory.notIn(notiCategory) : null;
}

private BooleanExpression eqNotiCategory(NotiCategory notiCategory) {
log.info("[NotificationQueryRepository] notiCategory : {}", notiCategory);
return notiCategory != null ? userActivityNotificationJpaEntity.activityNotificationJpaEntity.activityNotificationCategory.eq(notiCategory) : null;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.connect.accountApp.domain.activitynotification.application.port.in;

import com.connect.accountApp.domain.activitynotification.application.port.in.command.ActivityNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.in.command.ActivityNotificationsCommand;
import java.util.List;

public interface GetActivityNotificationsUseCase {

List<ActivityNotificationsCommand> getActivityNotification(Long userId);

List<ActivityNotificationCommand> getActivityNotifications(String userEmail);


Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.connect.accountApp.domain.activitynotification.application.port.out;

import com.connect.accountApp.domain.activitynotification.application.port.in.command.ActivityNotificationCommand;
import com.connect.accountApp.domain.activitynotification.application.port.out.command.NotificationCommand;
import com.connect.accountApp.domain.activitynotification.domain.model.ActivityNotification;
import java.util.List;

public interface FindActivityNotificationsPort {

List<NotificationCommand> findActivityNotifications(Long useId);

ActivityNotification findUserActivityNotification(Long activityNotificationId);

List<ActivityNotification> findUserActivityNotificationByBill(List<Long> billIds);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
public interface SaveActivityNotificationPort {

Long saveActivityNotification(ActivityNotification activityNotification);

void saveAllActivityNotification(List<ActivityNotification> activityNotification);

}
Loading

0 comments on commit ff54f93

Please sign in to comment.