I have the filter class bellow with 3 attributes to search for available books. I have two search cases: search through a list of book codes or search by date.
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class BookFilter {
Set<Long> bookCodes;
LocalDate fromDate;
LocalDate toDate;
}
This is my Controller
@GetMapping("/books")
public ResponseEntity<Page<BookView>> findAvailableBooks(BookFilter bookFilter, Pageable pageable) {
Page<Book> page = service.findAvailableBooks(bookFilter);
Page<BookView> map = page.map(book-> modelMapper.map(book, BookView.class));
return ResponseEntity.status(HttpStatus.OK).body(map);
}
And I'm trying to send request in Postman like:
http://localhost:8887/v1/api/library/books?fromDate=01-01-2019&toDate=01-31-2019
But I'm stuck in typeMismatch error: Failed to convert from type String to LocalDate. What am I missing?