Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

04 — Information Architecture (Library Module)

Screen tree, route map, and data model binding for the library surface. Routes are relative to the app's authenticated shell (see 00-shared/05). Server documents: Book (book.schema.ts:15-48), BorrowRecord (borrow-record.schema.ts:20-58).


1. Screen tree

/library
├── 4  Catalog List            /library
│   └── 5  Book Detail         /library/books/:id        (from list row)
│       ├── 8  Issue Form      /library/books/:id/issue  (sheet on mobile)
│       └── 7  Book Form       /library/books/:id/edit   (edit; create from FAB)
├── 7  Book Form (create)      /library/books/new        (FAB on Catalog List)
├── 6  Borrowed-by-Me          /library/my-borrows
│   └── 9  Return Form         /library/my-borrows/return/:recordId (sheet)
├── 10 Overdue View            /library/overdue          (derived; server scan planned)
└── Fine pay                    inline action on any borrow record row (sheet confirm)

2. Navigation rules

  • Catalog List is the library home; search is in-place (no separate screen).
  • Book Detail is the hub: view metadata, availability, active loans (planned) — it routes to Issue (if available), Edit (if permitted).
  • Borrowed-by-Me is a two-tab screen: Active (status=active) / History (status=returned, newest first — library.service.ts:196 sorts borrowedAt desc).
  • Overdue View is a derived list of active records where now > dueDate; gated to staff (books.issue/books.return). Server-side scan (planned).
  • No deep-linking to a borrow record route exists server-side; client uses record id as the key.

3. Data model (client views of server docs)

Book (book.schema.ts:15-48, base.schema.ts):

Book { id, tenantId, title, author, isbn,
       publisher?, category?, edition?,
       totalCopies, availableCopies,
       status: available|borrowed|damaged|lost,   // book.schema.ts:7-12,40-41
       shelfLocation?, description?,
       createdAt, updatedAt, version }
  • Derived client fields: availability = availableCopies, isAvailable = availableCopies > 0, copyBadge = "$availableCopies/$totalCopies".

BorrowRecord (borrow-record.schema.ts:20-58):

BorrowRecord { id, tenantId,
               bookId (populated → Book by repo: borrow-record.repository.ts:31,42),
               studentId (ref Student — NOT populated by any repo method today),
               issuedBy? (ref User — never written: library.service.ts:132-139),
               borrowedAt, dueDate, returnedAt?,
               status: active|returned|overdue|lost,   // :40-45
               fineAmount, fineStatus?: pending|paid|waived,  // :47-54
               notes? }
  • Derived client fields: isOverdue = status==active && now > dueDate, finePreview = ceil((now - dueDate)/day) × 5 (mirrors server rule library.service.ts:211-217; authoritative only after return).

4. Labels & status vocabulary

Server enumValueUI badgeWhere
BookStatusavailable / borrowed / damaged / lostgreen / amber (borrowed) / red / greybook.schema.ts:7-12
BorrowStatusactive / returned / overdue / lostblue / grey / red / redborrow-record.schema.ts:7-12
FineStatuspending / paid / waivedamber / green / greyborrow-record.schema.ts:14-18
  • overdue and lost on borrow records are never written by any endpoint today (OQ-2/OQ-4) — client derives overdue; lost is future.
  • Fine amounts have no currency contract (plain Number, rate 5/day, library.service.ts:25) — render as plain units.

5. Metadata & search surface

  • Server search: q regex over title/author/ISBN, case-insensitive (book.repository.ts:26-30); pagination page/limit via buildPaginationMeta (library.service.ts:75).
  • Client-side filters only: category, publisher, status, availability (OQ-5).
  • Sort: title asc server-side default (book.repository.ts:36); no sort query param on GET /books — client re-sorts in memory.

6. Cross-module references

  • studentId → Students module profile (client pulls id from student state; OQ-9).
  • issuedBy → Users module (field dead today, OQ-3).
  • Events BookIssued / BookReturned (library.service.ts:141-148,180-191) → notifications pipeline (proposed).
  • Covers: Files module (files.controller.ts:29-71) exists; no cover field on Book (OQ-8) — cover attachments (proposed).