Cotton code
449 lines · 11.2 KB · JSONRaw
{  "format_version": 1,  "id": "issue",  "setup": true,  "name": "Issue",  "plural": "Issues",  "picture": null,  "builtin": true,  "engine": "repos",  "core_links": true,  "screen_family": "core",  "columns": [    {      "key": "repo_id",      "name": "Repository",      "type": "link",      "link_to": "repository",      "readonly": true    },    {      "key": "number",      "type": "number",      "readonly": true    },    {      "key": "title",      "type": "text",      "required": true    },    {      "key": "body",      "name": "Description",      "type": "longtext"    },    {      "key": "state",      "type": "choice",      "choices": [        "open",        "closed"      ],      "readonly": true    },    {      "key": "author",      "type": "text",      "readonly": true    },    {      "key": "comments_count",      "name": "Comments",      "type": "number",      "readonly": true    },    {      "key": "html_url",      "name": "Web address",      "type": "text",      "readonly": true    },    {      "key": "remote_created_at",      "name": "Filed",      "type": "date",      "readonly": true    },    {      "key": "remote_updated_at",      "name": "Updated",      "type": "date",      "readonly": true    },    {      "key": "closed_at",      "name": "Closed",      "type": "date",      "readonly": true    },    {      "key": "origin",      "name": "Hosted by",      "type": "choice",      "choices": [        "forgejo",        "github",        "cotton"      ],      "readonly": true    },    {      "key": "open_in",      "name": "Open in",      "type": "link",      "link_to": "repository",      "readonly": true    },    {      "key": "title_line",      "name": "Issue",      "type": "text",      "readonly": true    },    {      "key": "meta_line",      "name": "About",      "type": "text",      "readonly": true    },    {      "key": "labels",      "name": "Labels",      "type": "text"    },    {      "key": "closed_line",      "name": "Over",      "type": "text",      "readonly": true    }  ],  "title": "title",  "date": "remote_updated_at",  "project": null,  "order": null,  "slip": {    "title": "title_line",    "subtitle": "meta_line",    "trailing": "state",    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "title",        "author",        "number",        "remote_created_at",        "state",        "repo_id",        "body"      ]    },    {      "heading": "Conversation",      "columns": [],      "list": {        "table": "repo_comment",        "link": "issue_id",        "limit": 10      }    }  ],  "instructions": "An issue is a problem or request filed against a repository, numbered within it, open or closed. Issues are indexed from the host; the owner's own work items are todos, not issues.",  "add": false,  "group": {    "column": "state",    "sections": [      {        "heading": "Open",        "values": [          "open"        ]      },      {        "heading": "Closed",        "values": [          "closed"        ],        "closed": true      }    ]  },  "empty": {    "title": "No issues.",    "message": "Every issue the host holds is kept here once the Mac that serves you has read this repository."  },  "sort": {    "column": "remote_updated_at",    "descending": true  },  "readonly_when": "closed_line",  "conversation": {    "table": "repo_comment",    "links": [      "issue_id"    ],    "body": "body",    "at": "remote_created_at",    "mine": {      "column": "by",      "values": [        "owner"      ]    },    "blank_body": "verdict_said",    "footer": [      "author",      "verdict",      "place"    ],    "placeholder": "Say something on this issue"  },  "parts": {    "shape": "desk",    "head": {      "facts": [        "author",        "number",        "remote_created_at"      ],      "state": "state"    },    "links": [      "repo_id"    ],    "body": "body",    "lists": [      {        "table": "repo_comment",        "relation": "issue_id",        "heading": "Conversation"      }    ],    "acts": {      "more": []    }  },  "tables": [    {      "name": "cotton_repo_issues",      "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": "repo_id",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    repo_id TEXT NOT NULL",          "position": 2        },        {          "name": "number",          "type": "INTEGER",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    number INTEGER NOT NULL",          "position": 3        },        {          "name": "remote_id",          "type": "INTEGER",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_id INTEGER",          "position": 4        },        {          "name": "title",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    title TEXT NOT NULL",          "position": 5        },        {          "name": "body",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    body TEXT",          "position": 6        },        {          "name": "state",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    state TEXT NOT NULL",          "position": 7        },        {          "name": "author",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    author TEXT",          "position": 8        },        {          "name": "labels",          "type": "TEXT",          "default": "'[]'",          "nullable": false,          "primary_key": false,          "declaration": "\n    labels TEXT NOT NULL DEFAULT '[]'",          "position": 9        },        {          "name": "comments_count",          "type": "INTEGER",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    comments_count INTEGER",          "position": 10        },        {          "name": "html_url",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    html_url TEXT",          "position": 11        },        {          "name": "remote_created_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_created_at TEXT",          "position": 12        },        {          "name": "remote_updated_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    remote_updated_at TEXT",          "position": 13        },        {          "name": "closed_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    closed_at TEXT",          "position": 14        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 15        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 16        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 17        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 18        }      ],      "constraints": [        {          "declaration": "\n    UNIQUE (workspace_id, repo_id, number)",          "position": 19        },        {          "declaration": "\n    CHECK (state IN ('open', 'closed'))",          "position": 20        },        {          "declaration": "\n    CHECK (json_type(labels) = 'array')",          "position": 21        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE",          "position": 22        },        {          "declaration": "\n    FOREIGN KEY (repo_id) REFERENCES cotton_repos(id)\n  ",          "position": 23        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_repo_issues (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_issues_repo ON cotton_repo_issues (workspace_id, repo_id, state, remote_updated_at DESC)",        "CREATE INDEX IF NOT EXISTS idx_cotton_repo_issues_author ON cotton_repo_issues (substr(_hlc, 20), _hlc)"      ],      "full_text": [        "CREATE VIRTUAL TABLE fts_repo_issues USING fts5(\n       title, body, content = 'cotton_repo_issues', content_rowid = 'rowid',\n       tokenize = 'unicode61 remove_diacritics 2'\n     )"      ],      "triggers": [        "CREATE TRIGGER fts_repo_issues_ai AFTER INSERT ON cotton_repo_issues WHEN new.rowid >= coalesce((SELECT floor FROM _fts_fill WHERE fts = 'fts_repo_issues'), 0) BEGIN\n       INSERT INTO fts_repo_issues (rowid, title, body) VALUES (new.rowid, new.title, new.body);\n     END",        "CREATE TRIGGER fts_repo_issues_ad AFTER DELETE ON cotton_repo_issues WHEN old.rowid >= coalesce((SELECT floor FROM _fts_fill WHERE fts = 'fts_repo_issues'), 0) BEGIN\n       INSERT INTO fts_repo_issues (fts_repo_issues, rowid, title, body) VALUES ('delete', old.rowid, old.title, old.body);\n     END",        "CREATE TRIGGER fts_repo_issues_au AFTER UPDATE OF title, body ON cotton_repo_issues\n       FOR EACH ROW WHEN old.rowid >= coalesce((SELECT floor FROM _fts_fill WHERE fts = 'fts_repo_issues'), 0) AND (new.title IS NOT old.title OR new.body IS NOT old.body) BEGIN\n       INSERT INTO fts_repo_issues (fts_repo_issues, rowid, title, body) VALUES ('delete', old.rowid, old.title, old.body);\n       INSERT INTO fts_repo_issues (rowid, title, body) VALUES (new.rowid, new.title, new.body);\n     END"      ]    }  ],  "delete": false}