@Transactional(readOnly = false) public void deleteCommunity(Long communityId, Long userId) { Community community = userRepository.loadCommunityById(communityId); if (community.checkOwnership(userId) && community.getMembers().size() == 1) { logger.info("Deleting " + community); userRepository.deleteCommunity(community); } }
public Community getCommunityById(Long communityId) { return userRepository.loadCommunityById(communityId); }