-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
207 additions
and
145 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/letscareer/self_intro/domain/dto/SelfIntroDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
package com.example.letscareer.self_intro.domain.dto; | ||
|
||
import com.example.letscareer.self_intro.domain.model.SelfIntro; | ||
|
||
public record SelfIntroDTO( | ||
String title, | ||
int sequence, | ||
String content) { | ||
|
||
public static SelfIntroDTO from(SelfIntro selfIntro) { | ||
return new SelfIntroDTO( | ||
selfIntro.getTitle(), | ||
selfIntro.getSequence(), | ||
selfIntro.getContent() | ||
); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/example/letscareer/stage/domain/dto/AppealCareerDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
package com.example.letscareer.stage.domain.dto; | ||
|
||
import com.example.letscareer.appealCareer.domain.model.AppealCareer; | ||
|
||
public record AppealCareerDTO( | ||
Long careerId, | ||
String category, | ||
String title | ||
) { | ||
public static AppealCareerDTO from(AppealCareer appealCareer) { | ||
return new AppealCareerDTO( | ||
appealCareer.getCareer().getCareerId(), | ||
appealCareer.getCareer().getCategory().getValue(), | ||
appealCareer.getCareer().getTitle() | ||
); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/letscareer/stage/domain/dto/IntReviewDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
package com.example.letscareer.stage.domain.dto; | ||
|
||
import com.example.letscareer.int_review.domain.model.IntReview; | ||
|
||
public record IntReviewDTO( | ||
Long reviewId, | ||
String details, | ||
String qa, | ||
String feel | ||
) { | ||
public static IntReviewDTO from(IntReview intReview) { | ||
return new IntReviewDTO( | ||
intReview.getIntReviewId(), | ||
intReview.getMethod(), | ||
intReview.getQuestions(), | ||
intReview.getFeelings() | ||
); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/example/letscareer/stage/domain/dto/MidReviewDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
package com.example.letscareer.stage.domain.dto; | ||
|
||
import com.example.letscareer.mid_review.domain.model.MidReview; | ||
|
||
public record MidReviewDTO( | ||
Long reviewId, | ||
String free_review, | ||
String goal | ||
) { | ||
public static MidReviewDTO from(MidReview midReview) { | ||
return new MidReviewDTO( | ||
midReview.getMidReviewId(), | ||
midReview.getFreeReview(), | ||
midReview.getGoal() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/example/letscareer/stage/domain/dto/converter/StageConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.example.letscareer.stage.domain.dto.converter; | ||
|
||
import com.example.letscareer.appealCareer.domain.model.AppealCareer; | ||
import com.example.letscareer.self_intro.domain.dto.SelfIntroDTO; | ||
import com.example.letscareer.self_intro.domain.model.SelfIntro; | ||
import com.example.letscareer.stage.domain.dto.AppealCareerDTO; | ||
import com.example.letscareer.stage.domain.model.Stage; | ||
import com.example.letscareer.schedule.domain.model.Schedule; | ||
import com.example.letscareer.stage.domain.dto.StageDTO; | ||
|
||
import java.time.LocalDate; | ||
import java.time.Period; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class StageConverter { | ||
public static List<SelfIntroDTO> toSelfIntroDTOs(List<SelfIntro> selfIntros) { | ||
return selfIntros.stream() | ||
.map(SelfIntroDTO::from) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static List<AppealCareerDTO> toAppealCareerDTOs(List<AppealCareer> appealCareers) { | ||
return appealCareers.stream() | ||
.map(AppealCareerDTO::from) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static List<StageDTO> toStageDTOs(List<Stage> stages, Schedule schedule) { | ||
return stages.stream().map(stage -> { | ||
String dday = !schedule.isAlways() ? String.valueOf(calculateDday(stage.getDate())) : ""; | ||
return StageDTO.from(stage, schedule.isAlways(), dday); | ||
}).collect(Collectors.toList()); | ||
} | ||
|
||
private static int calculateDday(LocalDate date) { | ||
return Period.between(LocalDate.now(), date).getDays(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.