Skip to content

Commit

Permalink
Merge pull request #267 from TEAM-MODDY/refactor/#266
Browse files Browse the repository at this point in the history
#266 [refactor] 디자이너 메인뷰 만료된 지원서 안보이게 하기
  • Loading branch information
pkl0912 authored Mar 2, 2024
2 parents 1cf81d8 + e7946fd commit 46c1191
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ public HairModelApplication(Model model, HairLength hairLength, String hairDetai
}

public LocalDate getCreatedDate(){
LocalDate createDate = getCreatedAt().toLocalDate();
return createDate;
LocalDate createdDate = getCreatedAt().toLocalDate();
return createdDate;
}
public LocalDate getExpiredDate(){
LocalDate expiredDate = getCreatedAt().plusDays(7).toLocalDate();
return expiredDate;
}

public boolean isExpired() {
LocalDate expiredDate = getCreatedAt().plusDays(7).toLocalDate();
LocalDate currentDate = LocalDate.now();

return currentDate.isAfter(expiredDate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.moddy.server.service.model.ModelRetrieveService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -123,7 +124,15 @@ private Page<HairModelApplication> findApplicationsByPaging(final int page, fina
PageRequest pageRequest = PageRequest.of(page - 1, size, Sort.by(Sort.Direction.DESC, "id"));
Page<HairModelApplication> applicationPage = hairModelApplicationJpaRepository.findAll(pageRequest);

return applicationPage;
Page<HairModelApplication> nonExpiredApplications = applicationPage
.stream()
.filter(application -> !application.isExpired())
.collect(Collectors.collectingAndThen(
Collectors.toList(),
list -> new PageImpl<>(list, pageRequest, list.size())
));

return nonExpiredApplications;
}

private String getApplicationHairDetail(final Long applicationId) {
Expand Down

0 comments on commit 46c1191

Please sign in to comment.