|
12 | 12 | import kattsyn.dev.rentplace.dtos.ImageDTO; |
13 | 13 | import kattsyn.dev.rentplace.dtos.PropertyCreateEditDTO; |
14 | 14 | import kattsyn.dev.rentplace.dtos.PropertyDTO; |
| 15 | +import kattsyn.dev.rentplace.dtos.filters.PropertyFilterDTO; |
15 | 16 | import kattsyn.dev.rentplace.services.PropertyService; |
16 | 17 | import lombok.RequiredArgsConstructor; |
17 | 18 | import org.springframework.http.HttpStatus; |
@@ -76,6 +77,20 @@ public ResponseEntity<List<PropertyDTO>> getProperties() { |
76 | 77 | return ResponseEntity.ok(properties); |
77 | 78 | } |
78 | 79 |
|
| 80 | + @Operation( |
| 81 | + summary = "Получение всех объявлений, с фильтрацией", |
| 82 | + description = "Позволяет получить все объявления, с фильтрацией" |
| 83 | + ) |
| 84 | + @ApiResponses(value = { |
| 85 | + @ApiResponse(responseCode = "200", description = "Успешно", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PropertyDTO[].class))), |
| 86 | + @ApiResponse(responseCode = "500", description = "Непредвиденная ошибка со стороны сервера", content = @Content) |
| 87 | + }) |
| 88 | + @PostMapping(path = "/filtered/", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| 89 | + public ResponseEntity<List<PropertyDTO>> getPropertiesByFilter(@Valid @ModelAttribute PropertyFilterDTO propertyFilter) { |
| 90 | + List<PropertyDTO> properties = propertyService.findAllByFilter(propertyFilter); |
| 91 | + return ResponseEntity.ok(properties); |
| 92 | + } |
| 93 | + |
79 | 94 | @Operation( |
80 | 95 | summary = "Получение объявлений пользователя", |
81 | 96 | description = "Позволяет получить все объявления пользователя по его токену. Только для авторизованных пользователей." |
|
0 commit comments