Specs › bookstore · version 1 ·
feature
bookstore
features
bookstore-books, bookstore-stock, bookstore-received, bookstore-value

Bookstore: the model✎ edit

The books the store sells and what's on the shelf. Dates are stored as dates (2026-10-04), not as text, so they sort and compare; how they show is up to the page.

$enum Genre (fiction, mystery, sciencefiction, history, children, cooking, other)
$class Book (
  @key id: String,
  @label title: String,
  author: String,
  genre: Genre = other,
  price: Number,
  stock: Int = 0,
  reorderAt: Int = 3,
  received: Date?,
  @calc(stock <= reorderAt) low: Boolean,
  @calc(price * stock) value: Number,
) @tooltip("A book the store sells")

Declares 1 classes: Book.