Skip to content

Commit 400dd48

Browse files
authored
Merge pull request #215 from DDD-Community/feat/211/goal
feat(goal): 목표 dto 수정
2 parents 994acf7 + e6b44f9 commit 400dd48

File tree

7 files changed

+195
-154
lines changed

7 files changed

+195
-154
lines changed

app/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ dependencies {
6666
runtimeOnly(libs.h2)
6767
runtimeOnly(libs.postgresql)
6868

69-
7069
testImplementation(libs.spring.boot.starter.test)
7170
testImplementation(libs.spring.security.test)
7271

app/src/main/java/com/growit/app/goal/domain/goal/Goal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public boolean getDeleted() {
9595

9696
public Plan getPlanByDate(LocalDate date) {
9797
return plans.stream()
98-
.filter(plan -> plan.getPlanDuration().includes(date))
98+
.filter(plan -> plan.getDuration().includes(date))
9999
.findFirst()
100100
.orElseThrow(() -> new NotFoundException(GOAL_NOT_EXISTS_DATE.getCode()));
101101
}

app/src/main/java/com/growit/app/goal/domain/goal/plan/Plan.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public class Plan {
1717
private int weekOfMonth;
1818
private String content;
1919

20-
@JsonIgnore private PlanDuration planDuration;
20+
private PlanDuration duration;
2121

2222
@JsonIgnore
2323
public boolean isCurrentWeek() {
24-
return planDuration.includes(LocalDate.now());
24+
return duration.includes(LocalDate.now());
2525
}
2626

2727
public static Plan from(PlanDto dto, LocalDate goalStart) {
@@ -30,7 +30,7 @@ public static Plan from(PlanDto dto, LocalDate goalStart) {
3030
.id(IDGenerator.generateId())
3131
.weekOfMonth(dto.weekOfMonth())
3232
.content(dto.content())
33-
.planDuration(duration)
33+
.duration(duration)
3434
.build();
3535
}
3636

app/src/main/java/com/growit/app/goal/infrastructure/persistence/goal/GoalDBMapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public GoalEntity toEntity(Goal goal) {
3232
plan.getId(),
3333
plan.getWeekOfMonth(),
3434
plan.getContent(),
35-
plan.getPlanDuration().startDate(),
36-
plan.getPlanDuration().endDate(),
35+
plan.getDuration().startDate(),
36+
plan.getDuration().endDate(),
3737
entity))
3838
.toList());
3939
entity.setDeletedAt(goal.getDeleted() ? LocalDateTime.now() : null);
@@ -56,7 +56,7 @@ public Goal toDomain(GoalEntity entity) {
5656
Plan.builder()
5757
.id(planEntity.getUid())
5858
.weekOfMonth(planEntity.getWeekOfMonth())
59-
.planDuration(
59+
.duration(
6060
new PlanDuration(
6161
planEntity.getStartDate(), planEntity.getEndDate()))
6262
.content(planEntity.getContent())

app/src/main/resources/static/docs/swagger-spec.js

Lines changed: 173 additions & 145 deletions
Large diffs are not rendered by default.

app/src/test/java/com/growit/app/fake/goal/PlanFixture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Plan build() {
7171
.id(id)
7272
.weekOfMonth(weekOfMonth)
7373
.content(content)
74-
.planDuration(planDuration)
74+
.duration(planDuration)
7575
.build();
7676
}
7777
}

app/src/test/java/com/growit/app/goal/controller/GoalControllerTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ void getMyGoals() throws Exception {
118118
fieldWithPath("data[].plans[].weekOfMonth")
119119
.type(NUMBER)
120120
.description("주차"),
121+
fieldWithPath("data[].plans[].duration").description("기간 정보 객체"),
122+
fieldWithPath("data[].plans[].duration.startDate")
123+
.type(STRING)
124+
.description("시작일 (yyyy-MM-dd)"),
125+
fieldWithPath("data[].plans[].duration.endDate")
126+
.type(STRING)
127+
.description("종료일 (yyyy-MM-dd)"),
121128
fieldWithPath("data[].plans[].content")
122129
.type(STRING)
123130
.description("계획 내용"))
@@ -164,6 +171,13 @@ void getMyGoal() throws Exception {
164171
fieldWithPath("data.plans[].weekOfMonth")
165172
.type(NUMBER)
166173
.description("주차"),
174+
fieldWithPath("data.plans[].duration").description("기간 정보 객체"),
175+
fieldWithPath("data.plans[].duration.startDate")
176+
.type(STRING)
177+
.description("시작일 (yyyy-MM-dd)"),
178+
fieldWithPath("data.plans[].duration.endDate")
179+
.type(STRING)
180+
.description("종료일 (yyyy-MM-dd)"),
167181
fieldWithPath("data.plans[].content").type(STRING).description("계획 내용"))
168182
.build())));
169183
}

0 commit comments

Comments
 (0)