Implement borrowing deadlines, overdue restrictions, and loan history
Summary
This MR introduces a book borrowing tracking system with deadlines, penalty restrictions for overdue readers, and visual console styling.
Key Changes
-
Borrowing Records & Persistence:
- Created
BorrowRecordto trackborrow_date,due_date, andreturn_date. - Added persistent storage for records in
records.jsonviaDataManager.
- Created
-
Loan Rules & Penalties:
- Configured a 14-day loan period upon borrowing.
- Implemented
hasOverdueBookscheck inLibrarySystem. - Restricted borrowing and browsing catalog for users with overdue books.
-
UI / UX Improvements:
- Centralized ANSI color definitions in
Console.hpp. - Blocked menu options are grayed out dynamically in the Reader's cabinet.
- Active loans now display due dates (highlighted in red if overdue).
- Completed loan history now shows formatted borrow and return dates.
- Centralized ANSI color definitions in
How to Test
- Log in as a reader (
reader/reader/3). - Borrow a book and verify that it appears in "View My Current Borrowed Books" with a due date (+14 days).
- Simulate an overdue state (modify
due_dateorborrow_dateinrecords.jsonto an earlier timestamp). - Verify that options 1 and 4 in the Reader menu become grayed out and cannot be selected.
- Return the book and check "View My Borrowing History" to ensure return dates are displayed correctly.