[JITERA] Implement Reader-Book Management Module
Created by: chi-jitera
Overview
This pull request introduces a new module to manage the relationships between readers and books. It includes the creation of a ReaderBook model, a controller to handle operations, a service for business logic, and routes for API endpoints. This module will allow us to track which reader is reading which book.
Changes
-
Created ReaderBook Model:
- Defined the schema for the
ReaderBookmodel inmodels/ReaderBook.js. This schema includes fields for reader ID, book ID, and any additional metadata required for tracking.
- Defined the schema for the
-
Created ReaderBook Controller:
- Implemented functions in
controllers/readerBookController.jsto handle CRUD operations related to reader-book relationships, such as adding a new relationship, retrieving existing ones, updating, and deleting.
- Implemented functions in
-
Created ReaderBook Service:
- Developed the business logic in
services/readerBookService.jsto encapsulate the operations performed by the controller, ensuring separation of concerns and making the code more maintainable.
- Developed the business logic in
-
Defined Routes for ReaderBook:
- Set up the necessary routes in
routes/readerBookRoutes.jsto expose the API endpoints for managing reader-book relationships, including routes for creating, reading, updating, and deleting records.
- Set up the necessary routes in
-
Updated Server to Include ReaderBook Routes:
- Integrated the reader-book routes into the main server setup in
server.js, ensuring that the application can handle requests related to reader-book management.
- Integrated the reader-book routes into the main server setup in
This implementation provides a comprehensive solution for managing the relationships between readers and books, enhancing the overall functionality of the application.