Skip to content

[JITERA] Implement Reader Module for Managing Book Borrowers

chi le requested to merge feat/reader-module-1750781043 into main

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

  1. Created Reader Model:

    • A new file named Reader.js was created in the /models directory.
    • The schema for the Reader model includes attributes such as name, contactInfo, borrowedBooks, borrowDate, and returnDate.
    • 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);
  2. 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.

Merge request reports