Skip to content

Commit

Permalink
BookDto,BookController, BookMapper was added
Browse files Browse the repository at this point in the history
  • Loading branch information
ChabVlad committed Sep 6, 2024
1 parent 2501e1f commit 463a515
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/main/java/project/bookstore/BookStoreApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

@SpringBootApplication
public class BookStoreApplication {

public static void main(String[] args) {
SpringApplication.run(BookStoreApplication.class, args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import project.bookstore.dto.BookDto;
Expand All @@ -23,13 +25,13 @@ public List<BookDto> getAll() {
return bookService.findAll();
}

@GetMapping
public BookDto getBookById(Long id) {
@GetMapping("/{id}")
public BookDto getBookById(@PathVariable Long id) {
return bookService.getBookById(id);
}

@PostMapping
public BookDto createBook(CreateBookRequestDto requestBookDto) {
public BookDto createBook(@RequestBody CreateBookRequestDto requestBookDto) {
return bookMapper.toDto(bookService.save(requestBookDto));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package project.bookstore.repository;

import java.util.List;
import project.bookstore.dto.BookDto;
import project.bookstore.model.Book;

public interface BookRepository {
Expand Down

0 comments on commit 463a515

Please sign in to comment.