Class LibraryController

java.lang.Object
com.example.restapi.controller.LibraryController

@RestController @RequestMapping("/api/library") public class LibraryController extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • registerUser

      @PostMapping("/users/register") public org.springframework.http.ResponseEntity<?> registerUser(@RequestBody User user)
    • loginUser

      @PostMapping("/users/login") public org.springframework.http.ResponseEntity<?> loginUser(@RequestBody User user, jakarta.servlet.http.HttpSession session)
    • getUserSession

      @GetMapping("/users/session") public org.springframework.http.ResponseEntity<?> getUserSession(jakarta.servlet.http.HttpSession session)
    • getBooks

      @GetMapping("/books") public org.springframework.http.ResponseEntity<List<Book>> getBooks()
    • addBook

      @PostMapping("/books") public org.springframework.http.ResponseEntity<Book> addBook(@RequestBody Book book)
    • borrowBook

      @PostMapping("/books/borrow/{bookId}/users/{userId}") public org.springframework.http.ResponseEntity<String> borrowBook(@PathVariable Long bookId, @PathVariable Long userId)
    • returnBook

      @PostMapping("/books/return/{bookId}") public org.springframework.http.ResponseEntity<String> returnBook(@PathVariable Long bookId)
    • getUserProfile

      @GetMapping("/users/{userId}") public org.springframework.http.ResponseEntity<User> getUserProfile(@PathVariable Long userId)
    • getUserProfileByUsername

      @GetMapping("/users/byname/{username}") public org.springframework.http.ResponseEntity<User> getUserProfileByUsername(@PathVariable String username)
    • getBorrowedBooksByUser

      @GetMapping("/users/{username}/borrowed-books") public org.springframework.http.ResponseEntity<List<Map<String,Object>>> getBorrowedBooksByUser(@PathVariable String username)
    • deleteBorrowing

      @DeleteMapping("books/{bookId}/users/{userId}") public org.springframework.http.ResponseEntity<Void> deleteBorrowing(@PathVariable Long bookId, @PathVariable Long userId)