5
5
import com .fasterxml .jackson .core .JsonProcessingException ;
6
6
import com .fasterxml .jackson .databind .ser .impl .SimpleBeanPropertyFilter ;
7
7
import com .fasterxml .jackson .databind .ser .impl .SimpleFilterProvider ;
8
- import java .io .IOException ;
9
8
import java .util .Base64 ;
10
9
import java .util .List ;
11
10
import org .springframework .http .converter .json .MappingJacksonValue ;
@@ -27,26 +26,18 @@ public BookstoreController(BookstoreService bookstoreService) {
27
26
filterProvider .setFailOnUnknownId (false );
28
27
}
29
28
30
- @ GetMapping ("/create" )
31
- public String create () throws IOException {
32
-
33
- bookstoreService .createAuthors ();
34
-
35
- return "created" ;
36
- }
37
-
38
29
@ GetMapping ("/author/age/{id}" )
39
30
public int fetchAuthorAgeViaId (@ PathVariable long id ) {
40
- return bookstoreService .fetchAuthorAgeViaId (id );
31
+ return bookstoreService .fetchAuthorAgeViaId (id );
41
32
}
42
-
33
+
43
34
@ GetMapping ("/author/avatar/{id}" )
44
35
public String fetchAuthorAvatarViaId (@ PathVariable long id ) {
45
- return Base64 .getEncoder ().encodeToString (bookstoreService .fetchAuthorAvatarViaId (id ));
36
+ return Base64 .getEncoder ().encodeToString (bookstoreService .fetchAuthorAvatarViaId (id ));
46
37
}
47
-
38
+
48
39
@ GetMapping ("/authors/{age}" )
49
- public MappingJacksonValue fetchAuthorsByAgeGreaterThanEqual (@ PathVariable int age )
40
+ public MappingJacksonValue fetchAuthorsByAgeGreaterThanEqual (@ PathVariable int age )
50
41
throws JsonProcessingException {
51
42
52
43
List <Author > authors = bookstoreService .fetchAuthorsByAgeGreaterThanEqual (age );
@@ -57,7 +48,7 @@ public MappingJacksonValue fetchAuthorsByAgeGreaterThanEqual(@PathVariable int a
57
48
}
58
49
59
50
@ GetMapping ("/authors/details/{age}" )
60
- public List <Author > fetchAuthorsDetailsByAgeGreaterThanEqual (@ PathVariable int age )
51
+ public List <Author > fetchAuthorsDetailsByAgeGreaterThanEqual (@ PathVariable int age )
61
52
throws JsonProcessingException {
62
53
63
54
return bookstoreService .fetchAuthorsDetailsByAgeGreaterThanEqual (age );
0 commit comments