Skip to content

Commit

Permalink
[PBS-64][HoangHN] refactor: 🐍 change the api get buildings
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoang-Nguyen-Huy committed Oct 31, 2024
1 parent ffe6134 commit 2ea0016
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,12 @@ ApiResponse<List<Building>> getAllBuildings() {
.message("Get all buildings successfully")
.build();
}

@GetMapping("/buildings-option")
ApiResponse<List<Building>> getAllBuildingsForHomePage() {
return ApiResponse.<List<Building>>builder()
.data(buildingService.getAllBuildingsForHomePage())
.message("Get all buildings successfully")
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ Page<Building> findFilteredBuildings(@Param("address") String address,
Pageable pageable);

@Query("SELECT b FROM Building b WHERE b.status = com.swp.PodBookingSystem.enums.BuildingStatus.Active")
List<Building> findAll();
List<Building> findAllBuildingForHomPage();
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ public List<Building> searchBuildings(String keyword) {
public List<Building> getAllBuildings() {
return buildingRepository.findAll();
}

public List<Building> getAllBuildingsForHomePage() {
return buildingRepository.findAllBuildingForHomPage();
}
}

0 comments on commit 2ea0016

Please sign in to comment.