Skip to content

Commit

Permalink
feat : application layer dev (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingLeeSeungHoon committed Apr 2, 2024
1 parent dec28a9 commit 9e6b2bf
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.neo.needeachother.category.application;

import com.neo.needeachother.category.domain.Category;
import com.neo.needeachother.category.domain.CategoryId;
import com.neo.needeachother.category.domain.domainservice.ConfirmCategoryChangeableAdminService;
import com.neo.needeachother.category.domain.repository.CategoryRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static com.neo.needeachother.category.application.CategoryServiceHelper.*;

@Service
@RequiredArgsConstructor
public class CategoryVoteFilterService {

private final CategoryRepository categoryRepository;
private final ConfirmCategoryChangeableAdminService confirmCategoryChangeableAdminService;

@Transactional
public void modifyFilteringRate(CategoryId categoryId, String email, int changingRate){
Category foundCategory = findExistingCategory(categoryRepository, categoryId);
foundCategory.modifyFilteringRate(confirmCategoryChangeableAdminService, email, changingRate);
}

@Transactional
public void useFilter(CategoryId categoryId, String email){
Category foundCategory = findExistingCategory(categoryRepository, categoryId);
foundCategory.turnOnCommentRatingFilter(confirmCategoryChangeableAdminService, email);
}

@Transactional
public void notUseFilter(CategoryId categoryId, String email){
Category foundCategory = findExistingCategory(categoryRepository, categoryId);
foundCategory.turnOffCommentRatingFilter(confirmCategoryChangeableAdminService, email);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.neo.needeachother.category.application;

import com.neo.needeachother.category.domain.Category;
import com.neo.needeachother.category.domain.CategoryId;
import com.neo.needeachother.category.domain.domainservice.ConfirmCategoryChangeableAdminService;
import com.neo.needeachother.category.domain.repository.CategoryRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static com.neo.needeachother.category.application.CategoryServiceHelper.*;

@Service
@RequiredArgsConstructor
public class ModifyCategoryInformationService {

private final CategoryRepository categoryRepository;
private final ConfirmCategoryChangeableAdminService confirmCategoryChangeableAdminService;

@Transactional
public void changeCategoryTitle(CategoryId categoryId, String email, String title){
Category foundCategory = findExistingCategory(categoryRepository, categoryId);
foundCategory.modifyCategoryTitle(confirmCategoryChangeableAdminService, email, title);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ public void deleteCategory(CategoryId id, String email){
foundCategory.deleteCategory(confirmCategoryChangeableAdminService, email);
}

@Transactional
public void exposureCategory(CategoryId id, String email){
Category foundCategory = findExistingCategory(categoryRepository, id);
foundCategory.exposureCategory(confirmCategoryChangeableAdminService, email);
}

}

0 comments on commit 9e6b2bf

Please sign in to comment.