Crates.io | fkl_codegen_java |
lib.rs | fkl_codegen_java |
version | 0.4.0 |
source | src |
created_at | 2022-10-07 07:26:18.364918 |
updated_at | 2022-11-02 15:08:54.499019 |
description | Feakin is a architecture design and visual collaboration tool. This is the parser for Feakin. |
homepage | |
repository | https://github.com/feakin/fklang |
max_upload_size | |
id | 682557 |
size | 12,637 |
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);
}