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

Pet 308 fix : 도메인 서비스 내부의 트랜잭션 애노테이션 제거 #212

Merged
merged 2 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -1,4 +1,4 @@
package com.pawith.todoapplication.handler;
package com.pawith.batchmodule.todo;

import com.pawith.commonmodule.cache.operators.ValueOperator;
import com.pawith.commonmodule.event.MultiNotificationEvent;
Expand All @@ -17,7 +17,7 @@

@Slf4j
@Component
public class IncompleteTodoCountNotificationHandler extends AbstractBatchSchedulingHandler<IncompleteTodoCountInfoDao> {
public class IncompleteTodoCountNotificationBatchService extends AbstractBatchSchedulingHandler<IncompleteTodoCountInfoDao> {
private static final Integer BATCH_SIZE = 100;
private static final String CRON_EXPRESSION = "0 0 20 * * *"; // 매일 20시에 실행
private static final String NOTIFICATION_MESSAGE = "[%s] 오늘이 지나기 전, %s님에게 남은 %d개의 todo를 완료해주세요!";
Expand All @@ -27,7 +27,7 @@ public class IncompleteTodoCountNotificationHandler extends AbstractBatchSchedul
private final ApplicationEventPublisher applicationEventPublisher;
private final ValueOperator<Long, String> valueOperator;

public IncompleteTodoCountNotificationHandler(RegisterRepository registerRepository, UserQueryService userQueryService, ApplicationEventPublisher applicationEventPublisher, ValueOperator<Long, String> valueOperator) {
public IncompleteTodoCountNotificationBatchService(RegisterRepository registerRepository, UserQueryService userQueryService, ApplicationEventPublisher applicationEventPublisher, ValueOperator<Long, String> valueOperator) {
super(BATCH_SIZE, CRON_EXPRESSION);
this.registerRepository = registerRepository;
this.userQueryService = userQueryService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pawith.todoapplication.handler;
package com.pawith.batchmodule.todo;

import com.pawith.commonmodule.event.MultiNotificationEvent;
import com.pawith.commonmodule.event.NotificationEvent;
Expand All @@ -22,14 +22,14 @@
*/
@Slf4j
@Component
public class TodoNotificationHandler extends AbstractBatchSchedulingHandler<NotificationDao> {
public class TodoNotificationBatchService extends AbstractBatchSchedulingHandler<NotificationDao> {
private static final Integer BATCH_SIZE = 100;
private static final String CRON_EXPRESSION = "0 0 * * * *";

private final TodoNotificationRepository todoNotificationRepository;
private final ApplicationEventPublisher applicationEventPublisher;

public TodoNotificationHandler(TodoNotificationRepository todoNotificationRepository, ApplicationEventPublisher applicationEventPublisher) {
public TodoNotificationBatchService(TodoNotificationRepository todoNotificationRepository, ApplicationEventPublisher applicationEventPublisher) {
super(BATCH_SIZE, CRON_EXPRESSION);
this.todoNotificationRepository = todoNotificationRepository;
this.applicationEventPublisher = applicationEventPublisher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class TokenDeleteServiceImpl implements TokenDeleteService {

private final TokenRepository tokenRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
package com.pawith.todoapplication.service;

import static java.util.stream.Collectors.toList;

import com.pawith.commonmodule.annotation.ApplicationService;
import com.pawith.todoapplication.dto.request.AssignChangeRequest;
import com.pawith.todoapplication.handler.event.TodoAssignStatusChangeEvent;
import com.pawith.tododomain.entity.Assign;
import com.pawith.tododomain.entity.Register;
import com.pawith.tododomain.entity.Todo;
import com.pawith.tododomain.service.AssignDeleteService;
import com.pawith.tododomain.service.AssignQueryService;
import com.pawith.tododomain.service.AssignSaveService;
import com.pawith.tododomain.service.RegisterQueryService;
import com.pawith.tododomain.service.TodoQueryService;
import com.pawith.tododomain.service.*;
import com.pawith.userdomain.entity.User;
import com.pawith.userdomain.utils.UserUtils;
import jakarta.transaction.Transactional;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

import static java.util.stream.Collectors.toList;

@ApplicationService
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class AssignDeleteService {
private final AssignRepository assignRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.List;

@DomainService
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class AssignQueryService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class AssignSaveService {

private final AssignRepository assignRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class CategoryDeleteService {

private final CategoryRepository categoryRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class CategoryQueryService {

private final CategoryRepository categoryRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class CategorySaveService {

private final CategoryRepository categoryRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class PetDeleteService {

private final PetRepository petRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class PetQueryService {
private final PetRepository petRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import com.pawith.tododomain.entity.Pet;
import com.pawith.tododomain.repository.PetRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

@DomainService
@RequiredArgsConstructor
@Transactional
public class PetSaveService {
private final PetRepository petRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
import com.pawith.tododomain.entity.Register;
import com.pawith.tododomain.repository.RegisterRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@DomainService
@RequiredArgsConstructor
@Transactional
public class RegisterDeleteService {

private final RegisterRepository registerRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
Expand All @@ -21,7 +20,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class RegisterQueryService {
private final RegisterRepository registerRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
import com.pawith.tododomain.repository.RegisterRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.transaction.annotation.Transactional;

@DomainService
@RequiredArgsConstructor
@Transactional
public class RegisterSaveService {
private final RegisterRepository registerRepository;
private final ApplicationEventPublisher applicationEventPublisher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class RegisterValidateService {

private final RegisterRepository registerRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class TodoDeleteService {

private final TodoRepository todoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class TodoNotificationQueryService {

private final TodoNotificationRepository todoNotificationRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class TodoNotificationSaveService {
private final TodoNotificationRepository todoNotificationRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.transaction.annotation.Transactional;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;

@DomainService
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class TodoQueryService {

private final TodoRepository todoRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import com.pawith.tododomain.exception.TodoTeamNotFoundException;
import com.pawith.tododomain.repository.TodoTeamRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;
import java.util.function.Function;

@DomainService
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class TodoTeamQueryService {

private final TodoTeamRepository todoTeamRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@DomainService
@RequiredArgsConstructor
@Transactional
public class TodoTeamSaveService {

private final TodoTeamRepository todoTeamRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
import com.pawith.tododomain.exception.TodoError;
import com.pawith.tododomain.exception.TodoModificationNotAllowedException;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

@DomainService
@RequiredArgsConstructor
@Transactional
public class TodoValidateService {

public boolean validateDeleteAndUpdate(Todo todo, Register register) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.pawith.userdomain.exception.UserNotFoundException;
import com.pawith.userdomain.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
Expand All @@ -18,7 +17,6 @@
import java.util.stream.Collectors;

@DomainService
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class UserQueryService {
private final UserRepository userRepository;
Expand Down
Loading