From 997c2b7cf1520a39018422637b96311e1d7b9522 Mon Sep 17 00:00:00 2001 From: Ajay Negi Date: Mon, 16 Sep 2024 23:35:19 +0530 Subject: [PATCH] Refactor structure from layer to feature --- .../{entity/Books.java => book/Book.java} | 8 +- .../{controller => book}/BookController.java | 24 ++- .../libraryman_api/book/BookRepository.java | 11 ++ .../{service => book}/BookService.java | 16 +- .../BorrowingController.java | 4 +- .../BorrowingRepository.java | 3 +- .../BorrowingService.java | 20 +-- .../{entity => borrowing}/Borrowings.java | 13 +- .../com/libraryman_api/email/EmailSender.java | 2 +- .../libraryman_api/email/EmailService.java | 6 +- .../GlobalExceptionHandler.java | 4 +- .../{repository => fine}/FineRepository.java | 3 +- .../{entity => fine}/Fines.java | 2 +- .../MemberController.java | 4 +- .../MemberRepository.java | 5 +- .../{service => member}/MemberService.java | 5 +- .../{entity => member}/Members.java | 2 +- .../{entity => member}/Role.java | 2 +- .../NotificationRepository.java | 3 +- .../NotificationService.java | 148 +++++++++--------- .../NotificationStatus.java | 2 +- .../NotificationType.java | 2 +- .../Notifications.java | 3 +- .../repository/BookRepository.java | 12 -- src/main/resources/application.properties | 2 +- 25 files changed, 147 insertions(+), 159 deletions(-) rename src/main/java/com/libraryman_api/{entity/Books.java => book/Book.java} (92%) rename src/main/java/com/libraryman_api/{controller => book}/BookController.java (71%) create mode 100644 src/main/java/com/libraryman_api/book/BookRepository.java rename src/main/java/com/libraryman_api/{service => book}/BookService.java (87%) rename src/main/java/com/libraryman_api/{controller => borrowing}/BorrowingController.java (95%) rename src/main/java/com/libraryman_api/{repository => borrowing}/BorrowingRepository.java (85%) rename src/main/java/com/libraryman_api/{service => borrowing}/BorrowingService.java (95%) rename src/main/java/com/libraryman_api/{entity => borrowing}/Borrowings.java (85%) rename src/main/java/com/libraryman_api/{controller => exception}/GlobalExceptionHandler.java (91%) rename src/main/java/com/libraryman_api/{repository => fine}/FineRepository.java (71%) rename src/main/java/com/libraryman_api/{entity => fine}/Fines.java (97%) rename src/main/java/com/libraryman_api/{controller => member}/MemberController.java (95%) rename src/main/java/com/libraryman_api/{repository => member}/MemberRepository.java (72%) rename src/main/java/com/libraryman_api/{service => member}/MemberService.java (97%) rename src/main/java/com/libraryman_api/{entity => member}/Members.java (98%) rename src/main/java/com/libraryman_api/{entity => member}/Role.java (58%) rename src/main/java/com/libraryman_api/{repository => notification}/NotificationRepository.java (77%) rename src/main/java/com/libraryman_api/{service => notification}/NotificationService.java (72%) rename src/main/java/com/libraryman_api/{entity => notification}/NotificationStatus.java (56%) rename src/main/java/com/libraryman_api/{entity => notification}/NotificationType.java (93%) rename src/main/java/com/libraryman_api/{entity => notification}/Notifications.java (96%) delete mode 100644 src/main/java/com/libraryman_api/repository/BookRepository.java diff --git a/src/main/java/com/libraryman_api/entity/Books.java b/src/main/java/com/libraryman_api/book/Book.java similarity index 92% rename from src/main/java/com/libraryman_api/entity/Books.java rename to src/main/java/com/libraryman_api/book/Book.java index 68bff0b..b4d3f8e 100644 --- a/src/main/java/com/libraryman_api/entity/Books.java +++ b/src/main/java/com/libraryman_api/book/Book.java @@ -1,10 +1,10 @@ -package com.libraryman_api.entity; +package com.libraryman_api.book; import jakarta.persistence.*; @Entity -public class Books { +public class Book { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, @@ -33,10 +33,10 @@ public class Books { @Column(name = "copies_available", nullable = false) private int copiesAvailable; - public Books() { + public Book() { } - public Books(String title, String author, String isbn, String publisher, int publishedYear, String genre, int copiesAvailable) { + public Book(String title, String author, String isbn, String publisher, int publishedYear, String genre, int copiesAvailable) { this.title = title; this.author = author; this.isbn = isbn; diff --git a/src/main/java/com/libraryman_api/controller/BookController.java b/src/main/java/com/libraryman_api/book/BookController.java similarity index 71% rename from src/main/java/com/libraryman_api/controller/BookController.java rename to src/main/java/com/libraryman_api/book/BookController.java index 7dea8dd..778f7c4 100644 --- a/src/main/java/com/libraryman_api/controller/BookController.java +++ b/src/main/java/com/libraryman_api/book/BookController.java @@ -1,8 +1,6 @@ -package com.libraryman_api.controller; +package com.libraryman_api.book; -import com.libraryman_api.entity.Books; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.service.BookService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -25,10 +23,10 @@ public class BookController { /** * Retrieves a list of all books in the library. * - * @return a list of {@link Books} objects representing all the books in the library. + * @return a list of {@link Book} objects representing all the books in the library. */ @GetMapping - public List getAllBooks() { + public List getAllBooks() { return bookService.getAllBooks(); } @@ -36,11 +34,11 @@ public List getAllBooks() { * Retrieves a book by its ID. * * @param id the ID of the book to retrieve. - * @return a {@link ResponseEntity} containing the {@link Books} object, if found. + * @return a {@link ResponseEntity} containing the {@link Book} object, if found. * @throws ResourceNotFoundException if the book with the specified ID is not found. */ @GetMapping("/{id}") - public ResponseEntity getBookById(@PathVariable int id) { + public ResponseEntity getBookById(@PathVariable int id) { return bookService.getBookById(id) .map(ResponseEntity::ok) .orElseThrow(() -> new ResourceNotFoundException("Book not found")); @@ -49,11 +47,11 @@ public ResponseEntity getBookById(@PathVariable int id) { /** * Adds a new book to the library. * - * @param book the {@link Books} object representing the new book to add. - * @return the added {@link Books} object. + * @param book the {@link Book} object representing the new book to add. + * @return the added {@link Book} object. */ @PostMapping - public Books addBook(@RequestBody Books book) { + public Book addBook(@RequestBody Book book) { return bookService.addBook(book); } @@ -61,11 +59,11 @@ public Books addBook(@RequestBody Books book) { * Updates an existing book in the library. * * @param id the ID of the book to update. - * @param bookDetails the {@link Books} object containing the updated book details. - * @return the updated {@link Books} object. + * @param bookDetails the {@link Book} object containing the updated book details. + * @return the updated {@link Book} object. */ @PutMapping("/{id}") - public Books updateBook(@PathVariable int id, @RequestBody Books bookDetails) { + public Book updateBook(@PathVariable int id, @RequestBody Book bookDetails) { return bookService.updateBook(id, bookDetails); } diff --git a/src/main/java/com/libraryman_api/book/BookRepository.java b/src/main/java/com/libraryman_api/book/BookRepository.java new file mode 100644 index 0000000..013b353 --- /dev/null +++ b/src/main/java/com/libraryman_api/book/BookRepository.java @@ -0,0 +1,11 @@ +package com.libraryman_api.book; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookRepository extends JpaRepository { +} + + + diff --git a/src/main/java/com/libraryman_api/service/BookService.java b/src/main/java/com/libraryman_api/book/BookService.java similarity index 87% rename from src/main/java/com/libraryman_api/service/BookService.java rename to src/main/java/com/libraryman_api/book/BookService.java index 1b497e2..652f01a 100644 --- a/src/main/java/com/libraryman_api/service/BookService.java +++ b/src/main/java/com/libraryman_api/book/BookService.java @@ -1,8 +1,6 @@ -package com.libraryman_api.service; +package com.libraryman_api.book; -import com.libraryman_api.entity.Books; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.repository.BookRepository; import org.springframework.stereotype.Service; import java.util.List; @@ -42,7 +40,7 @@ public BookService(BookRepository bookRepository) { * * @return a list of all books */ - public List getAllBooks() { + public List getAllBooks() { return bookRepository.findAll(); } @@ -52,7 +50,7 @@ public List getAllBooks() { * @param bookId the ID of the book to retrieve * @return an {@code Optional} containing the found book, or {@code Optional.empty()} if no book was found */ - public Optional getBookById(int bookId) { + public Optional getBookById(int bookId) { return bookRepository.findById(bookId); } @@ -62,7 +60,7 @@ public Optional getBookById(int bookId) { * @param book the book to be added * @return the saved book */ - public Books addBook(Books book) { + public Book addBook(Book book) { return bookRepository.save(book); } @@ -74,8 +72,8 @@ public Books addBook(Books book) { * @return the updated book * @throws ResourceNotFoundException if the book with the specified ID is not found */ - public Books updateBook(int bookId, Books bookDetails) { - Books book = bookRepository.findById(bookId) + public Book updateBook(int bookId, Book bookDetails) { + Book book = bookRepository.findById(bookId) .orElseThrow(() -> new ResourceNotFoundException("Book not found")); book.setTitle(bookDetails.getTitle()); book.setAuthor(bookDetails.getAuthor()); @@ -94,7 +92,7 @@ public Books updateBook(int bookId, Books bookDetails) { * @throws ResourceNotFoundException if the book with the specified ID is not found */ public void deleteBook(int bookId) { - Books book = bookRepository.findById(bookId) + Book book = bookRepository.findById(bookId) .orElseThrow(() -> new ResourceNotFoundException("Book not found")); bookRepository.delete(book); } diff --git a/src/main/java/com/libraryman_api/controller/BorrowingController.java b/src/main/java/com/libraryman_api/borrowing/BorrowingController.java similarity index 95% rename from src/main/java/com/libraryman_api/controller/BorrowingController.java rename to src/main/java/com/libraryman_api/borrowing/BorrowingController.java index a0597d9..e76ae53 100644 --- a/src/main/java/com/libraryman_api/controller/BorrowingController.java +++ b/src/main/java/com/libraryman_api/borrowing/BorrowingController.java @@ -1,8 +1,6 @@ -package com.libraryman_api.controller; +package com.libraryman_api.borrowing; -import com.libraryman_api.entity.Borrowings; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.service.BorrowingService; import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/src/main/java/com/libraryman_api/repository/BorrowingRepository.java b/src/main/java/com/libraryman_api/borrowing/BorrowingRepository.java similarity index 85% rename from src/main/java/com/libraryman_api/repository/BorrowingRepository.java rename to src/main/java/com/libraryman_api/borrowing/BorrowingRepository.java index e89511e..5b077d3 100644 --- a/src/main/java/com/libraryman_api/repository/BorrowingRepository.java +++ b/src/main/java/com/libraryman_api/borrowing/BorrowingRepository.java @@ -1,6 +1,5 @@ -package com.libraryman_api.repository; +package com.libraryman_api.borrowing; -import com.libraryman_api.entity.Borrowings; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/libraryman_api/service/BorrowingService.java b/src/main/java/com/libraryman_api/borrowing/BorrowingService.java similarity index 95% rename from src/main/java/com/libraryman_api/service/BorrowingService.java rename to src/main/java/com/libraryman_api/borrowing/BorrowingService.java index 1a1ce6e..668d0cc 100644 --- a/src/main/java/com/libraryman_api/service/BorrowingService.java +++ b/src/main/java/com/libraryman_api/borrowing/BorrowingService.java @@ -1,11 +1,11 @@ -package com.libraryman_api.service; +package com.libraryman_api.borrowing; -import com.libraryman_api.entity.Books; -import com.libraryman_api.entity.Borrowings; -import com.libraryman_api.entity.Fines; +import com.libraryman_api.book.BookService; +import com.libraryman_api.book.Book; +import com.libraryman_api.fine.Fines; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.repository.BorrowingRepository; -import com.libraryman_api.repository.FineRepository; +import com.libraryman_api.fine.FineRepository; +import com.libraryman_api.notification.NotificationService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; @@ -88,10 +88,10 @@ public Optional getBorrowingById(int borrowingId) { */ @Transactional public synchronized Borrowings borrowBook(Borrowings borrowing) { - Optional book = bookService.getBookById(borrowing.getBook().getBookId()); + Optional book = bookService.getBookById(borrowing.getBook().getBookId()); if (book.isPresent()) { - Books bookEntity = book.get(); + Book bookEntity = book.get(); if (bookEntity.getCopiesAvailable() > 0) { updateBookCopies(borrowing.getBook().getBookId(), "REMOVE", 1); @@ -198,10 +198,10 @@ public String payFine(int borrowingId) { * @throws ResourceNotFoundException if the book is not found or if there are not enough copies to remove */ public void updateBookCopies(int bookId, String operation, int numberOfCopies) { - Optional book = bookService.getBookById(bookId); + Optional book = bookService.getBookById(bookId); if (book.isPresent()) { - Books bookEntity = book.get(); + Book bookEntity = book.get(); if (operation.equals("ADD")) { bookEntity.setCopiesAvailable(bookEntity.getCopiesAvailable() + numberOfCopies); } else if (operation.equals("REMOVE")) { diff --git a/src/main/java/com/libraryman_api/entity/Borrowings.java b/src/main/java/com/libraryman_api/borrowing/Borrowings.java similarity index 85% rename from src/main/java/com/libraryman_api/entity/Borrowings.java rename to src/main/java/com/libraryman_api/borrowing/Borrowings.java index ac11285..c562e40 100644 --- a/src/main/java/com/libraryman_api/entity/Borrowings.java +++ b/src/main/java/com/libraryman_api/borrowing/Borrowings.java @@ -1,5 +1,8 @@ -package com.libraryman_api.entity; +package com.libraryman_api.borrowing; +import com.libraryman_api.book.Book; +import com.libraryman_api.fine.Fines; +import com.libraryman_api.member.Members; import jakarta.persistence.*; import java.util.Date; @@ -17,7 +20,7 @@ public class Borrowings { @ManyToOne @JoinColumn(name = "book_id", nullable = false) - private Books book; + private Book book; @OneToOne @JoinColumn(name = "fine_id") @@ -40,7 +43,7 @@ public class Borrowings { public Borrowings() { } - public Borrowings(Books book, Members member, Date borrowDate, Date dueDate, Date returnDate) { + public Borrowings(Book book, Members member, Date borrowDate, Date dueDate, Date returnDate) { this.book = book; this.member = member; this.borrowDate = borrowDate; @@ -60,11 +63,11 @@ public int getBorrowingId() { return borrowingId; } - public Books getBook() { + public Book getBook() { return book; } - public void setBook(Books book) { + public void setBook(Book book) { this.book = book; } diff --git a/src/main/java/com/libraryman_api/email/EmailSender.java b/src/main/java/com/libraryman_api/email/EmailSender.java index 3689596..d4bd9e7 100644 --- a/src/main/java/com/libraryman_api/email/EmailSender.java +++ b/src/main/java/com/libraryman_api/email/EmailSender.java @@ -1,6 +1,6 @@ package com.libraryman_api.email; -import com.libraryman_api.entity.Notifications; +import com.libraryman_api.notification.Notifications; /** * Interface representing an email sending service for the Library Management System. diff --git a/src/main/java/com/libraryman_api/email/EmailService.java b/src/main/java/com/libraryman_api/email/EmailService.java index 2e2954e..288723f 100644 --- a/src/main/java/com/libraryman_api/email/EmailService.java +++ b/src/main/java/com/libraryman_api/email/EmailService.java @@ -1,8 +1,8 @@ package com.libraryman_api.email; -import com.libraryman_api.entity.NotificationStatus; -import com.libraryman_api.entity.Notifications; -import com.libraryman_api.repository.NotificationRepository; +import com.libraryman_api.notification.NotificationStatus; +import com.libraryman_api.notification.Notifications; +import com.libraryman_api.notification.NotificationRepository; import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; import org.slf4j.Logger; diff --git a/src/main/java/com/libraryman_api/controller/GlobalExceptionHandler.java b/src/main/java/com/libraryman_api/exception/GlobalExceptionHandler.java similarity index 91% rename from src/main/java/com/libraryman_api/controller/GlobalExceptionHandler.java rename to src/main/java/com/libraryman_api/exception/GlobalExceptionHandler.java index ece2876..26704ef 100644 --- a/src/main/java/com/libraryman_api/controller/GlobalExceptionHandler.java +++ b/src/main/java/com/libraryman_api/exception/GlobalExceptionHandler.java @@ -1,7 +1,5 @@ -package com.libraryman_api.controller; +package com.libraryman_api.exception; -import com.libraryman_api.exception.ErrorDetails; -import com.libraryman_api.exception.ResourceNotFoundException; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; diff --git a/src/main/java/com/libraryman_api/repository/FineRepository.java b/src/main/java/com/libraryman_api/fine/FineRepository.java similarity index 71% rename from src/main/java/com/libraryman_api/repository/FineRepository.java rename to src/main/java/com/libraryman_api/fine/FineRepository.java index 9addac4..900c26f 100644 --- a/src/main/java/com/libraryman_api/repository/FineRepository.java +++ b/src/main/java/com/libraryman_api/fine/FineRepository.java @@ -1,6 +1,5 @@ -package com.libraryman_api.repository; +package com.libraryman_api.fine; -import com.libraryman_api.entity.Fines; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/libraryman_api/entity/Fines.java b/src/main/java/com/libraryman_api/fine/Fines.java similarity index 97% rename from src/main/java/com/libraryman_api/entity/Fines.java rename to src/main/java/com/libraryman_api/fine/Fines.java index c475b72..48e06c2 100644 --- a/src/main/java/com/libraryman_api/entity/Fines.java +++ b/src/main/java/com/libraryman_api/fine/Fines.java @@ -1,4 +1,4 @@ -package com.libraryman_api.entity; +package com.libraryman_api.fine; import jakarta.persistence.*; diff --git a/src/main/java/com/libraryman_api/controller/MemberController.java b/src/main/java/com/libraryman_api/member/MemberController.java similarity index 95% rename from src/main/java/com/libraryman_api/controller/MemberController.java rename to src/main/java/com/libraryman_api/member/MemberController.java index 36c7218..246589c 100644 --- a/src/main/java/com/libraryman_api/controller/MemberController.java +++ b/src/main/java/com/libraryman_api/member/MemberController.java @@ -1,8 +1,6 @@ -package com.libraryman_api.controller; +package com.libraryman_api.member; -import com.libraryman_api.entity.Members; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.service.MemberService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/com/libraryman_api/repository/MemberRepository.java b/src/main/java/com/libraryman_api/member/MemberRepository.java similarity index 72% rename from src/main/java/com/libraryman_api/repository/MemberRepository.java rename to src/main/java/com/libraryman_api/member/MemberRepository.java index 9811d1a..fffa8d8 100644 --- a/src/main/java/com/libraryman_api/repository/MemberRepository.java +++ b/src/main/java/com/libraryman_api/member/MemberRepository.java @@ -1,11 +1,8 @@ -package com.libraryman_api.repository; +package com.libraryman_api.member; -import com.libraryman_api.entity.Borrowings; -import com.libraryman_api.entity.Members; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import java.util.List; import java.util.Optional; @Repository diff --git a/src/main/java/com/libraryman_api/service/MemberService.java b/src/main/java/com/libraryman_api/member/MemberService.java similarity index 97% rename from src/main/java/com/libraryman_api/service/MemberService.java rename to src/main/java/com/libraryman_api/member/MemberService.java index af60bad..b73e384 100644 --- a/src/main/java/com/libraryman_api/service/MemberService.java +++ b/src/main/java/com/libraryman_api/member/MemberService.java @@ -1,8 +1,7 @@ -package com.libraryman_api.service; +package com.libraryman_api.member; -import com.libraryman_api.entity.Members; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.repository.MemberRepository; +import com.libraryman_api.notification.NotificationService; import org.springframework.stereotype.Service; import java.util.List; import java.util.Optional; diff --git a/src/main/java/com/libraryman_api/entity/Members.java b/src/main/java/com/libraryman_api/member/Members.java similarity index 98% rename from src/main/java/com/libraryman_api/entity/Members.java rename to src/main/java/com/libraryman_api/member/Members.java index 49ca4f5..f11b805 100644 --- a/src/main/java/com/libraryman_api/entity/Members.java +++ b/src/main/java/com/libraryman_api/member/Members.java @@ -1,4 +1,4 @@ -package com.libraryman_api.entity; +package com.libraryman_api.member; import jakarta.persistence.*; diff --git a/src/main/java/com/libraryman_api/entity/Role.java b/src/main/java/com/libraryman_api/member/Role.java similarity index 58% rename from src/main/java/com/libraryman_api/entity/Role.java rename to src/main/java/com/libraryman_api/member/Role.java index 2bb0351..e92e5a6 100644 --- a/src/main/java/com/libraryman_api/entity/Role.java +++ b/src/main/java/com/libraryman_api/member/Role.java @@ -1,4 +1,4 @@ -package com.libraryman_api.entity; +package com.libraryman_api.member; public enum Role { ADMIN, LIBRARIAN, USER diff --git a/src/main/java/com/libraryman_api/repository/NotificationRepository.java b/src/main/java/com/libraryman_api/notification/NotificationRepository.java similarity index 77% rename from src/main/java/com/libraryman_api/repository/NotificationRepository.java rename to src/main/java/com/libraryman_api/notification/NotificationRepository.java index 891eb99..7311298 100644 --- a/src/main/java/com/libraryman_api/repository/NotificationRepository.java +++ b/src/main/java/com/libraryman_api/notification/NotificationRepository.java @@ -1,6 +1,5 @@ -package com.libraryman_api.repository; +package com.libraryman_api.notification; -import com.libraryman_api.entity.Notifications; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/com/libraryman_api/service/NotificationService.java b/src/main/java/com/libraryman_api/notification/NotificationService.java similarity index 72% rename from src/main/java/com/libraryman_api/service/NotificationService.java rename to src/main/java/com/libraryman_api/notification/NotificationService.java index 7436b36..2a146bd 100644 --- a/src/main/java/com/libraryman_api/service/NotificationService.java +++ b/src/main/java/com/libraryman_api/notification/NotificationService.java @@ -1,10 +1,10 @@ -package com.libraryman_api.service; +package com.libraryman_api.notification; +import com.libraryman_api.borrowing.Borrowings; import com.libraryman_api.email.EmailSender; -import com.libraryman_api.entity.*; import com.libraryman_api.exception.ResourceNotFoundException; -import com.libraryman_api.repository.MemberRepository; -import com.libraryman_api.repository.NotificationRepository; +import com.libraryman_api.member.MemberRepository; +import com.libraryman_api.member.Members; import org.springframework.stereotype.Service; import java.sql.Timestamp; @@ -247,75 +247,77 @@ private String subject(NotificationType notificationType) { private String buildEmail(String notificationType,String memberName, String notificationMessage) { - return "
\n" + - "\n" + - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
\n" + - " \n" + - " \n" + - " " +notificationType+ - "\n" + - "
\n" + - " \n" + - "
\n" + - " \n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
\n" + - " \n" + - "
\n" + - "\n" + - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "


\n" + - " \n" + - "

Hi " + memberName + ",

" + notificationMessage + "

" + - "

Best regards,

" + - "

LibraryMan

" + - " \n" + - "


\n" + - "\n" + - "
"; + return """ +
\n" + + + \n" + + + \n" + + \n" + + \n" + + \n" + +
\n" + + \n" + + \n" + + \n" + + \n" + + \n" + +
\n" + + \n" + + \n" + + \n" + + \n" + + \n" + +
\n" + + \n" + + \n" + + " +notificationType+ + \n" + +
\n" + + \n" + +
\n" + + \n" + +
\n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + +
\n" + + \n" + + \n" + + \n" + + \n" + + \n" + +
\n" + + \n" + +
\n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + + \n" + +


\n" + + \n" + +

Hi " + memberName + ",

" + notificationMessage + "

" + +

Best regards,

" + +

LibraryMan

" + + \n" + +


\n" + + +
+ """; } diff --git a/src/main/java/com/libraryman_api/entity/NotificationStatus.java b/src/main/java/com/libraryman_api/notification/NotificationStatus.java similarity index 56% rename from src/main/java/com/libraryman_api/entity/NotificationStatus.java rename to src/main/java/com/libraryman_api/notification/NotificationStatus.java index 441050d..cb3cd85 100644 --- a/src/main/java/com/libraryman_api/entity/NotificationStatus.java +++ b/src/main/java/com/libraryman_api/notification/NotificationStatus.java @@ -1,4 +1,4 @@ -package com.libraryman_api.entity; +package com.libraryman_api.notification; public enum NotificationStatus { SENT, FAILED diff --git a/src/main/java/com/libraryman_api/entity/NotificationType.java b/src/main/java/com/libraryman_api/notification/NotificationType.java similarity index 93% rename from src/main/java/com/libraryman_api/entity/NotificationType.java rename to src/main/java/com/libraryman_api/notification/NotificationType.java index f94fd3b..f2d4dc3 100644 --- a/src/main/java/com/libraryman_api/entity/NotificationType.java +++ b/src/main/java/com/libraryman_api/notification/NotificationType.java @@ -1,4 +1,4 @@ -package com.libraryman_api.entity; +package com.libraryman_api.notification; /** diff --git a/src/main/java/com/libraryman_api/entity/Notifications.java b/src/main/java/com/libraryman_api/notification/Notifications.java similarity index 96% rename from src/main/java/com/libraryman_api/entity/Notifications.java rename to src/main/java/com/libraryman_api/notification/Notifications.java index a52ae9d..3ef9cb6 100644 --- a/src/main/java/com/libraryman_api/entity/Notifications.java +++ b/src/main/java/com/libraryman_api/notification/Notifications.java @@ -1,5 +1,6 @@ -package com.libraryman_api.entity; +package com.libraryman_api.notification; +import com.libraryman_api.member.Members; import jakarta.persistence.*; import java.sql.Timestamp; diff --git a/src/main/java/com/libraryman_api/repository/BookRepository.java b/src/main/java/com/libraryman_api/repository/BookRepository.java deleted file mode 100644 index c2a1e28..0000000 --- a/src/main/java/com/libraryman_api/repository/BookRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.libraryman_api.repository; - -import com.libraryman_api.entity.Books; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface BookRepository extends JpaRepository { -} - - - diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 21abc9b..53718a7 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,2 +1,2 @@ spring.application.name=libraryman-api -spring.profiles.active=${ENV:dev} +spring.profiles.active=${ENV:development} \ No newline at end of file