6 releases
0.4.0 | Nov 2, 2022 |
---|---|
0.3.0 | Oct 26, 2022 |
0.2.3 | Oct 19, 2022 |
#2980 in Parser implementations
33 downloads per month
Used in fkl_cli
155KB
5K
SLoC
FKL Codegen
Feakin killall language,
Book API
// createBook with @PutMapping("/book/:id) and BookRequest in BookController, and return Book id
@PutMapping("/book/:id")
public Book createBook(@PathVariable("id") Long id, @RequestBody BookRequest bookRequest) {
Book book = new Book();
book.setId(id);
book.setTitle(bookRequest.getTitle());
book.setAuthor(bookRequest.getAuthor());
book.setPrice(bookRequest.getPrice());
return book;
}
BookCreated
// create book in bookRepository and return BookResponse
public BookResponse createBook(BookRequest bookRequest) {
Book book = new Book(bookRequest);
bookRepository.save(book);
return new BookResponse(book);
}
BookUpdated
// updateBook with BookUpdateRequest and return BookResponse
public BookResponse updateBook(BookUpdateRequest bookUpdateRequest) {
Book book = bookRepository.findById(bookUpdateRequest.getId());
book.update(bookUpdateRequest);
bookRepository.save(book);
return new BookResponse(book);
}
Dependencies
~9MB
~139K SLoC