You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A full-stack library management system built for COSC 3380 (Database Systems). It supports patron registration, item borrowing, hold queues, room reservations, device rentals, fee management, and an admin reporting dashboard.
All patron features + manage items, process returns, manage holds, look up users
Admin
All staff features + manage staff accounts, view analytics reports
Role values in the database
role
staff_permissions
Description
2
—
Patron
1
1
Staff
1
2
Admin
API Routes
All routes are prefixed with /api and the server runs on port 3000.
Auth
Method
Route
Auth
Description
POST
/api/auth/register
Public
Register a new patron
POST
/api/auth/login
Public
Login and receive JWT token
POST
/api/auth/register-staff
Admin
Register a new staff or admin account
Items
Method
Route
Auth
Description
GET
/api/items
Any
Browse catalog
GET
/api/items/:id
Any
Get item details with copies
POST
/api/items
Staff
Add a new item
PUT
/api/items/:id
Staff
Update item details
DELETE
/api/items/:id
Staff
Soft-remove a copy
Borrowing
Method
Route
Auth
Description
GET
/api/borrow
Staff
View all borrow records
GET
/api/borrow/:person_id
Any (self)
View borrow history for a person
POST
/api/borrow
Any
Borrow an item
POST
/api/borrow/return
Any
Return a borrowed item
Holds
Method
Route
Auth
Description
GET
/api/holds
Staff
View all holds
GET
/api/holds/:person_id
Any (self)
View holds for a person
POST
/api/holds
Any
Place a hold
DELETE
/api/holds/:hold_id
Any (self or staff)
Cancel a hold
Fees
Method
Route
Auth
Description
GET
/api/fees
Staff
View all fees
GET
/api/fees/:person_id
Any (self)
View fees for a person
POST
/api/fees/pay
Any
Pay a fee
Rooms & Reservations
Method
Route
Auth
Description
GET
/api/rooms
Staff
List all rooms
POST
/api/rooms
Staff
Add a room
PATCH
/api/rooms/:room_id
Staff
Update room status
GET
/api/reservations
Staff
View all reservations
GET
/api/reservations/:person_id
Any (self)
View reservations for a person
GET
/api/reservations/available
Any
Query available time slots
POST
/api/reservations
Any
Make a reservation
DELETE
/api/reservations/:reservation_id
Any (self or staff)
Cancel a reservation
Notifications
Method
Route
Auth
Description
GET
/api/notifications
Any
Get all notifications for logged-in user
GET
/api/notifications/summary
Any
Get unread notification count
PUT
/api/notifications/:id
Any
Mark notification as read
PUT
/api/notifications/:id/unread
Any
Mark notification as unread
PUT
/api/notifications/read-all
Any
Mark all notifications as read
Users & Staff
Method
Route
Auth
Description
GET
/api/users
Staff
List all patrons
GET
/api/users/lookup
Staff
Look up a specific user
PUT
/api/users/profile
Any
Update own profile
PUT
/api/users/deactivate
Any
Deactivate own account
GET
/api/staff
Admin
List all staff
PUT
/api/staff/:person_id
Admin
Update staff permissions
DELETE
/api/staff/:person_id
Admin
Deactivate a staff account
Reports (Admin Only)
Method
Route
Description
GET
/api/reports/overview
General KPIs
GET
/api/reports/popularity
Item popularity report
GET
/api/reports/patrons
Patron activity report
GET
/api/reports/fees
Fee and fine report
GET
/api/reports/revenue
Revenue report
Features Overview
Borrowing System
Patrons can borrow available copies of books, CDs, and devices
Each item type has a configurable borrow period
Late, damage, and loss fees are automatically applied on return
A patron with unpaid fees has their borrowing privileges suspended (enforced by DB trigger)
Hold Queue
Patrons can place holds on items that are currently checked out
Holds are queued by placement time
When a copy becomes available, the next patron in the queue is automatically promoted to "Ready" status via a database trigger
Ready holds expire after 2 days if not picked up
Patrons are limited to 2 active holds at a time
Room Reservations
Patrons can reserve study rooms in hourly slots between 8 AM and 9 PM
Maximum reservation length is 4 hours per booking
If a room is taken offline by staff, all active reservations are cancelled and patrons are notified
Notifications
Patrons receive in-app notifications for:
Fee added to account (type 2)
Fee resolved / borrowing restored (type 2)
Hold promoted to ready (type 1)
Room reservation cancelled (type 4)
Notifications can be individually marked read or unread, or all marked read at once
Reports (Admin)
Popularity Report — most borrowed items, borrow counts, genre breakdowns
Patron Activity Report — most active patrons, borrow history
Fee Report — fee totals, outstanding balances, payment history
Revenue Report — income over time from fee payments
All reports can be exported to PDF
Database Triggers
Three triggers are defined in COSC3380_LIBRARYDB.sql:
restrict_borrow_on_fee
Fires:AFTER INSERT ON FeeOwed
Action: When a new unpaid fee (status=1) is created, sets the patron's borrow_status = 0, preventing them from checking out items
unrestrict_borrow_on_paid
Fires:AFTER UPDATE ON FeeOwed
Action: When a fee is marked paid (status changes from 1 to 2), checks if the patron has any remaining unpaid fees. If none remain, restores borrow_status = 1
promote_next_hold
Fires:AFTER UPDATE ON Copy
Action: When a copy's status changes to 1 (available), finds the next waiting hold in the queue, promotes it to ready (status=2), sets a 2-day expiry, and inserts a hold-ready notification for the patron