Skip to content

[JITERA] Add Reader Model

chi le requested to merge feat/add-reader-model-1754401457 into main

Created by: chi-jitera

Overview

This pull request introduces a new Mongoose model for managing readers in the application. The Reader model includes fields for storing reader information and tracking borrowed books.

Changes

  1. Reader Schema:
    • Added a new schema for the Reader model located in /models/Reader.js.
    • The schema includes the following fields:
      • name: A required string field to store the reader's name.
      • contactInfo: A required string field to store the reader's contact information.
      • borrowedBooks: An array of objects that track the books borrowed by the reader. Each object contains:
        • book: A reference to the Book model.
        • borrowDate: The date the book was borrowed, defaulting to the current date.
        • returnDate: The date the book was returned (optional).
        • status: A string that indicates whether the book is 'borrowed' or 'returned', defaulting to 'borrowed'.
        • dueDate: The date by which the book should be returned (optional).

This model will facilitate the management of readers and their borrowed books within the application.

Merge request reports