511 lines · 12.2 KB · JSONRaw
{ "format_version": 1, "id": "news_story", "name": "Story", "plural": "Stories", "builtin": true, "visibility": "owner", "title": "headline", "columns": [ { "key": "edition_id", "type": "link", "link_to": "news_edition", "required": true, "readonly": true }, { "key": "topic_id", "type": "link", "link_to": "news_topic", "readonly": true }, { "key": "rank", "type": "number", "readonly": true }, { "key": "headline", "type": "text", "readonly": true }, { "key": "lede", "type": "longtext", "readonly": true }, { "key": "bullets", "type": "longtext", "readonly": true }, { "key": "sources", "type": "longtext", "readonly": true, "presentation": "sources" }, { "key": "why_care", "type": "text", "readonly": true }, { "key": "read_minutes", "type": "number", "readonly": true }, { "key": "opened_at", "type": "date", "readonly": true }, { "key": "feedback", "type": "choice", "choices": [ "less", "more" ], "labels": { "less": "Less", "more": "More" }, "readonly": true }, { "key": "body", "type": "longtext", "readonly": true }, { "key": "why_it_matters", "name": "Why it matters", "type": "longtext", "readonly": true }, { "key": "first_source_url", "type": "text", "readonly": true }, { "key": "note_body", "type": "longtext", "readonly": true } ], "instructions": "A story is one item of a news edition: its headline, the bullets, why it matters and the sources it was written from, in the edition's rank order. Stories are read only; quote them as their sources say and never add to them. feedback holds the owner's less or more for a story, which steers what later editions bring; null takes it back. opened_at is stamped the first time the story is read.", "tables": [ { "name": "cotton_news_stories", "columns": [ { "name": "id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n id TEXT PRIMARY KEY", "position": 0 }, { "name": "edition_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n edition_id TEXT NOT NULL", "position": 1 }, { "name": "topic_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n topic_id TEXT", "position": 2 }, { "name": "rank", "type": "INTEGER", "default": null, "nullable": false, "primary_key": false, "declaration": "\n rank INTEGER NOT NULL", "position": 3 }, { "name": "headline", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n headline TEXT NOT NULL", "position": 4 }, { "name": "lede", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n lede TEXT NOT NULL", "position": 5 }, { "name": "bullets", "type": "TEXT", "default": "'[]'", "nullable": false, "primary_key": false, "declaration": "\n bullets TEXT NOT NULL DEFAULT '[]'", "position": 6 }, { "name": "sources", "type": "TEXT", "default": "'[]'", "nullable": false, "primary_key": false, "declaration": "\n sources TEXT NOT NULL DEFAULT '[]'", "position": 7 }, { "name": "why_care", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n why_care TEXT", "position": 8 }, { "name": "read_minutes", "type": "INTEGER", "default": null, "nullable": true, "primary_key": false, "declaration": "\n read_minutes INTEGER", "position": 9 }, { "name": "opened_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n opened_at TEXT", "position": 10 }, { "name": "feedback", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n feedback TEXT", "position": 11 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 12 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 13 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 14 } ], "constraints": [ { "declaration": "\n CHECK (feedback IS NULL OR feedback IN ('less', 'more'))", "position": 15 }, { "declaration": "\n CHECK (rank >= 0)", "position": 16 }, { "declaration": "\n CHECK ((read_minutes IS NULL) OR (read_minutes >= 0))", "position": 17 }, { "declaration": "\n FOREIGN KEY (edition_id) REFERENCES cotton_news_editions(id)\n ", "position": 18 } ], "prefix": "CREATE TABLE cotton_news_stories (", "suffix": ")", "indexes": [ "CREATE INDEX idx_cotton_news_stories_edition_rank ON cotton_news_stories (edition_id, rank)", "CREATE INDEX IF NOT EXISTS idx_cotton_news_stories_author ON cotton_news_stories (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] }, { "name": "cotton_news_seen", "columns": [ { "name": "id", "type": "TEXT", "default": null, "nullable": true, "primary_key": true, "declaration": "\n id TEXT PRIMARY KEY", "position": 0 }, { "name": "workspace_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n workspace_id TEXT NOT NULL", "position": 1 }, { "name": "topic_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n topic_id TEXT NOT NULL", "position": 2 }, { "name": "key", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n \"key\" TEXT NOT NULL", "position": 3 }, { "name": "title_hash", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n title_hash TEXT", "position": 4 }, { "name": "url", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n url TEXT", "position": 5 }, { "name": "source", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n source TEXT NOT NULL", "position": 6 }, { "name": "first_seen_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n first_seen_at TEXT NOT NULL", "position": 7 }, { "name": "story_id", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n story_id TEXT", "position": 8 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 9 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 10 } ], "constraints": [ { "declaration": "\n UNIQUE (workspace_id, \"key\")", "position": 11 }, { "declaration": "\n CHECK (source IN ('google_news', 'hn', 'brave', 'rss'))", "position": 12 }, { "declaration": "\n FOREIGN KEY (topic_id) REFERENCES cotton_news_topics(id)", "position": 13 }, { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 14 } ], "prefix": "CREATE TABLE cotton_news_seen (", "suffix": ")", "indexes": [ "CREATE INDEX idx_cotton_news_seen_topic ON cotton_news_seen (workspace_id, topic_id, first_seen_at DESC)", "CREATE INDEX IF NOT EXISTS idx_cotton_news_seen_author ON cotton_news_seen (substr(_hlc, 20), _hlc)" ], "full_text": [], "triggers": [] } ], "picture": { "photo": "photo:54118bbc8327cc8d43e587bd19db1841feff49cc5220ae6ca7384167e9cb414e", "object": "tool-news" }, "engine": "news", "date": null, "project": null, "order": null, "slip": { "title": "headline", "subtitle": "lede", "trailing": "topic_id", "photo": null, "toggle": null, "unread": "opened_at" }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "headline", "lede", "body", "why_it_matters", "sources" ] }, { "heading": "Details", "columns": [ "topic_id", "edition_id", "feedback", "opened_at" ] } ], "page_parts": [ "title", "facts", "content", "grid" ], "delete": false, "commands": [ { "id": "reader", "label": "Save article", "kind": "create", "verb": "create_page", "data": {}, "bindings": { "url": "first_source_url", "title": "headline" }, "receipt": "Saved to Articles", "does": "moves", "object": "bookmark" }, { "id": "opened", "label": "Mark read", "kind": "update", "verb": "mark_news_story_opened", "data": {}, "bindings": { "id": "$id" } } ], "on_open": "opened", "parts": { "shape": "desk", "head": { "facts": [ "opened_at", "feedback" ] }, "links": [ "edition_id", "topic_id" ], "body": "lede", "lists": [], "acts": { "main": "reader", "more": [] }, "strip": [ { "column": "body" }, { "column": "why_it_matters" }, { "column": "sources" }, { "column": "topic_id" }, { "column": "edition_id" }, { "column": "feedback" } ] }}