home screens tables
This page is generated by bin/prototype.hs table-html prototype_screens.
prototype_screens
The screens
table describes the different screens of the prototype. Screens are like pages but more with a role within an application, whereas pages are more informative. Its records are automatically created in db.Makefile
by running insert-screens.sql
, which copies part of the prototype_metadata
table.
A screen specifies a SQL query to fetch the necessary data to populate it, and a route where the screen should be visible. By combining the two pieces of information, the serve.hs
script is able to automatically make the right data available at the right route. The query is expected to return JSON.
For instance given the view-item
screen, (if serve.hs
is running) you should be able to visit /item/1.
CREATE TABLE prototype_screens (
name TEXT PRIMARY KEY,
route TEXT NOT NULL,
type ENUM NOT NULL CHECK(type IN ('VIEW','LIST')),
query TEXT NOT NULL,
ids TEXT NOT NULL
);
Defined: sql/prototype.sql:20
name route type query ids
--------- --------- ---- ------------------------------------------------------------------------------------------------ --------------------
view-item /item/:id VIEW SELECT json_object('id', id, 'description', description, 'status', status) FROM items WHERE id=? SELECT id FROM items
Command: sqlite3 prototype.db "SELECT * FROM prototype_screens LIMIT 100"