[JITERA] Implement Reader Module for Managing Book Borrowers
Created by: chi-jitera
Overview
This pull request introduces the Reader module, which is responsible for managing readers who borrow books. The module includes the creation of the Reader model, service, controller, and routes to facilitate reader-related operations.
Changes Made
-
Created Reader Model:
- A new file named
Reader.jswas created in the/modelsdirectory. - The schema for the Reader model includes attributes such as
name,contactInfo,borrowedBooks,borrowDate, andreturnDate. - This model will allow us to store and manage reader information effectively.
const mongoose = require('../config/db'); const readerSchema = new mongoose.Schema({ name: { type: String, required: true }, contactInfo: { type: String, required: true }, borrowedBooks: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Book' }], borrowDate: { type: Date, default: Date.now }, returnDate: { type: Date } }); module.exports = mongoose.model('Reader', readerSchema); - A new file named
-
Next Steps:
- The next steps will involve creating the Reader service to handle business logic related to readers, implementing the Reader controller for HTTP request handling, and defining routes for reader operations.
This implementation sets the foundation for the reader management functionality in the application.