File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
src/main/java/mx/com/pandadevs/pibeapi/models/vacants Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 44import org .springframework .data .jpa .repository .JpaRepository ;
55import org .springframework .stereotype .Repository ;
66
7+ import java .time .LocalDateTime ;
78import java .util .List ;
89import java .util .Optional ;
910
1011@ Repository
1112public interface VacantRepository extends JpaRepository <Vacant , Integer > {
1213 List <Vacant > findAllByActiveIsTrueAndIsPublicIsTrue ();
14+ List <Vacant > findAllByActiveIsTrueAndIsPublicIsTrueAndEndDateGreaterThanEqual (LocalDateTime time );
1315 Optional <Vacant > findByIdAndActiveIsTrue (Integer id );
1416}
Original file line number Diff line number Diff line change 2323import org .springframework .util .ReflectionUtils ;
2424
2525import java .lang .reflect .Field ;
26+ import java .time .LocalDateTime ;
2627import java .util .ArrayList ;
2728import java .util .List ;
2829import java .util .Map ;
@@ -64,7 +65,8 @@ public VacantService(VacantMapper mapper) {
6465
6566 @ Transactional (readOnly = true )
6667 public List <VacantDto > getAll () {
67- return mapper .toVacantsDto (vacantRepository .findAllByActiveIsTrueAndIsPublicIsTrue ());
68+ LocalDateTime nowTime = LocalDateTime .now ();
69+ return mapper .toVacantsDto (vacantRepository .findAllByActiveIsTrueAndIsPublicIsTrueAndEndDateGreaterThanEqual (nowTime ));
6870 }
6971
7072 @ Transactional (readOnly = true )
You can’t perform that action at this time.
0 commit comments