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

[feat/CK-242] 로드맵 관련 부분 의존성 리팩토링을 한다 #206

Merged
merged 23 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d72b469
refactor: roadmap 관련 코드 패키지 분리
Ohjintaek Dec 19, 2023
2ea6239
refactor: RoadmapCreateService에서 goalRoom 의존성 제거
Ohjintaek Dec 19, 2023
91f128b
refactor: RoadmapReadService에서 goalRoom 의존성 제거
Ohjintaek Dec 19, 2023
7085619
refactor: RoadmapScheduler에서 goalRoom 의존성 제거 및 테스트코드 패키지 분리
Ohjintaek Dec 19, 2023
3c0ba17
refactor: Roadmap에서 발생한 예외는 RoaadmapException을 던지도록 수정
Ohjintaek Dec 22, 2023
354f9b6
refactor: RoadmapSaveArgumentResolver 의존성 역전
Ohjintaek Dec 22, 2023
c8fc8f4
test: 테스트 코드 수정
Ohjintaek Dec 22, 2023
a307525
chore: build.gradle 수정 (jacoco 테스트 커버리지)
Ohjintaek Dec 22, 2023
7ce0184
refactor: roadmap과 roadmapReview에서 member 직접 참조를 삭제
Ohjintaek Jan 12, 2024
b63f1b7
chore: ScrollResponseMapper common으로 이관
Ohjintaek Jan 13, 2024
a0f588b
refactor: 로드맵 삭제 시 하위 골룸 삭제 방식 변경 (OnDelete 옵션 사용)
Ohjintaek Jan 13, 2024
3d6cd17
chore: 패키지 경로 수정
Ohjintaek Jan 13, 2024
df672b0
refactor: dto 패키지 분리
Ohjintaek Jan 13, 2024
7a1b1f3
refactor: Event 객체에서 도메인 직접 전달 제거
Ohjintaek Jan 14, 2024
3c5fc04
refactor: RoadmapNode에서 RoadmapContent 의존 제거
Ohjintaek Jan 14, 2024
9cf3c2a
refactor: Roadmap과 RoadmapContent, RoadmapReview간 의존 관계 제거
Ohjintaek Jan 14, 2024
bdccbbc
refactor: Roadmap 생성 시 태그, RoadmapContent 생성 시 노드들을 필수로 넣도록 수정
Ohjintaek Jan 21, 2024
5cf8113
test: RoadmapNodes 테스트코드 추가
Ohjintaek Jan 21, 2024
a0472bc
refactor: 불필요한 클래스 삭제
Ohjintaek Feb 15, 2024
732673f
fix: 데이터베이스 무결성 오류 수정
Ohjintaek Feb 15, 2024
fc761d5
refactor: 로드맵 삭제 시 연관된 리뷰 삭제를 이벤트로 발행
Ohjintaek Feb 16, 2024
ac71f6e
chore: merge conflict 해결
Ohjintaek Mar 27, 2024
3a7e610
refactor: 불필요한 이벤트 호출 제거
Ohjintaek Mar 27, 2024
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
4 changes: 3 additions & 1 deletion backend/kirikiri/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jacocoTestReport {
fileTree(dir: it, excludes: [
"co/kirikiri/persistence/QuerydslRepositorySupporter",
"co/kirikiri/domain/**",
"co/kirikiri/**/domain/**",
"co/kirikiri/persistence/goalroom/dto/**",
"**/*Application*",
"**/*Config*",
Expand Down Expand Up @@ -115,7 +116,8 @@ jacocoTestCoverageVerification {

excludes = [
"co.kirikiri.persistence.QuerydslRepositorySupporter",
"co.kirikiri.domain.**.**",
"co.kirikiri.domain.**",
"co.kirikiri.**.domain.**",
"co.kirikiri.persistence.goalroom.dto.**",
"**.*Application*",
"**.*Config*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.time.Duration;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
Expand All @@ -17,6 +16,8 @@
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;

import java.time.Duration;

@Configuration
@EnableCaching
@Profile(value = {"prod", "dev", "local"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import co.kirikiri.common.interceptor.AuthInterceptor;
import co.kirikiri.common.resolver.MemberIdentifierArgumentResolver;
import co.kirikiri.common.resolver.RoadmapSaveArgumentResolver;
import co.kirikiri.roadmap.resolver.RoadmapSaveArgumentResolver;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.kirikiri.service.dto;
package co.kirikiri.common.dto;

import jakarta.validation.constraints.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.kirikiri.service.dto;
package co.kirikiri.common.dto;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.kirikiri.service.dto;
package co.kirikiri.common.dto;

import java.io.InputStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package co.kirikiri.service.mapper;
package co.kirikiri.common.mapper;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.List;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package co.kirikiri.controller;

import co.kirikiri.service.dto.ErrorResponse;
import co.kirikiri.common.dto.ErrorResponse;
import co.kirikiri.service.exception.AuthenticationException;
import co.kirikiri.service.exception.BadRequestException;
import co.kirikiri.service.exception.ConflictException;
import co.kirikiri.service.exception.ForbiddenException;
import co.kirikiri.service.exception.NotFoundException;
import co.kirikiri.service.exception.ServerException;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
Expand All @@ -17,6 +16,8 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.List;

@RestControllerAdvice
public class GlobalExceptionHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import co.kirikiri.service.goalroom.GoalRoomCreateService;
import co.kirikiri.service.goalroom.GoalRoomReadService;
import jakarta.validation.Valid;
import java.net.URI;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -34,6 +32,9 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.net.URI;
import java.util.List;

@RestController
@RequestMapping("/goal-rooms")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import co.kirikiri.common.interceptor.Authenticated;
import co.kirikiri.common.resolver.MemberIdentifier;
import co.kirikiri.service.member.MemberService;
import co.kirikiri.service.dto.member.request.MemberJoinRequest;
import co.kirikiri.service.dto.member.response.MemberInformationForPublicResponse;
import co.kirikiri.service.dto.member.response.MemberInformationResponse;
import co.kirikiri.service.member.MemberService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
Expand All @@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.URI;

@RestController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;

import java.util.Objects;

@MappedSuperclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PreUpdate;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package co.kirikiri.domain;

import co.kirikiri.domain.exception.ImageExtensionException;

import java.util.Arrays;

public enum ImageContentType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.data.annotation.CreatedDate;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

@MappedSuperclass
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class BaseGoalRoomMember extends BaseEntity {
Expand All @@ -31,6 +34,7 @@ public abstract class BaseGoalRoomMember extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_room_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@QueryInit(value = {"roadmapContent.roadmap"})
protected GoalRoom goalRoom;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import co.kirikiri.domain.goalroom.vo.GoalRoomName;
import co.kirikiri.domain.goalroom.vo.LimitedMemberCount;
import co.kirikiri.domain.member.Member;
import co.kirikiri.domain.roadmap.RoadmapContent;
import co.kirikiri.roadmap.domain.RoadmapContent;
import jakarta.persistence.Column;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
Expand All @@ -14,13 +14,16 @@
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -39,6 +42,7 @@ public class GoalRoom extends BaseUpdatedTimeEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "roadmap_content_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private RoadmapContent roadmapContent;

@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.persistence.Entity;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import jakarta.persistence.Embeddable;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.BatchSize;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.BatchSize;

@Embeddable
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import co.kirikiri.domain.member.Member;
import jakarta.persistence.Entity;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class GoalRoomPendingMember extends BaseGoalRoomMember {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import jakarta.persistence.Embeddable;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.BatchSize;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.BatchSize;

@Embeddable
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import co.kirikiri.domain.BaseEntity;
import co.kirikiri.domain.goalroom.exception.GoalRoomException;
import co.kirikiri.domain.goalroom.vo.Period;
import co.kirikiri.domain.roadmap.RoadmapNode;
import co.kirikiri.roadmap.domain.RoadmapNode;
import jakarta.persistence.Embedded;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.time.LocalDate;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.time.LocalDate;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand All @@ -26,6 +29,7 @@ public class GoalRoomRoadmapNode extends BaseEntity {

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "roadmap_node_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private RoadmapNode roadmapNode;

public GoalRoomRoadmapNode(final Period period, final Integer checkCount, final RoadmapNode roadmapNode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.IntStream;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@Embeddable
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.persistence.Entity;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.persistence.OneToMany;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import co.kirikiri.domain.goalroom.exception.GoalRoomException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

@Embeddable
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Period {
Expand Down
Loading