-
Notifications
You must be signed in to change notification settings - Fork 2
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
9 changed files
with
163 additions
and
68 deletions.
There are no files selected for viewing
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
44 changes: 44 additions & 0 deletions
44
src/main/java/umc/kkijuk/server/introduce/dto/IntroduceListResDto.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,44 @@ | ||
package umc.kkijuk.server.introduce.dto; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import umc.kkijuk.server.introduce.domain.Introduce; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.Duration; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
@Getter | ||
@Setter | ||
public class IntroduceListResDto { | ||
private Long id; | ||
private Long recruitId; | ||
private String recruitTitle; | ||
private String deadline; | ||
private String updatedAt; | ||
private String timeSinceUpdate; | ||
private int state; | ||
|
||
@Builder | ||
public IntroduceListResDto(Introduce introduce) { | ||
this.id = introduce.getId(); | ||
this.recruitId=introduce.getRecruit().toModel().getId(); | ||
this.recruitTitle=introduce.getRecruit().toModel().getTitle(); | ||
this.deadline=formatUpdatedAt(introduce.getRecruit().toModel().getEndTime()); | ||
this.updatedAt = formatUpdatedAt(introduce.getUpdated_at()); | ||
this.timeSinceUpdate = calculateTimeUntilDeadline(introduce.getUpdated_at()); | ||
this.state=introduce.getState(); | ||
} | ||
|
||
private String formatUpdatedAt(LocalDateTime updatedAt) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | ||
return updatedAt != null ? updatedAt.format(formatter) : null; | ||
} | ||
|
||
private String calculateTimeUntilDeadline(LocalDateTime deadline) { | ||
Duration duration = Duration.between(LocalDateTime.now(), deadline); | ||
long days = duration.toDays(); | ||
return days > 0 ? "D-" + days : "공고 기한 마감"; | ||
} | ||
} |
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
15 changes: 0 additions & 15 deletions
15
src/main/java/umc/kkijuk/server/introduce/dto/QuestionReqDto.java
This file was deleted.
Oops, something went wrong.
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