Cotton code
247 lines · 5.7 KB · JSONRaw
{  "format_version": 1,  "id": "placement_proposal",  "name": "List of secrets for your Macs",  "plural": "Secrets for your Macs",  "builtin": true,  "visibility": "owner",  "date": "created_at",  "title": "title",  "columns": [    {      "key": "title",      "name": "List",      "type": "text",      "readonly": true    },    {      "key": "items",      "name": "What goes where",      "type": "text",      "readonly": true    },    {      "key": "status",      "type": "text",      "readonly": true    },    {      "key": "decided_at",      "type": "date",      "format": "calendar-datetime",      "readonly": true    },    {      "key": "count",      "name": "How many",      "type": "text",      "readonly": true    },    {      "key": "created_at",      "name": "Asked",      "type": "date",      "readonly": true    }  ],  "instructions": "A list of placements an assistant asked the owner to approve: which secret goes on which Mac at which path, never a value. The owner approves or declines the whole list; approving writes every placement and each Mac writes its own files. Never write a column.",  "tables": [    {      "name": "cotton_placement_proposals",      "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": "title",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    title TEXT NOT NULL",          "position": 2        },        {          "name": "items",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    items TEXT NOT NULL",          "position": 3        },        {          "name": "status",          "type": "TEXT",          "default": "'open'",          "nullable": false,          "primary_key": false,          "declaration": "\n    status TEXT NOT NULL DEFAULT 'open'",          "position": 4        },        {          "name": "decided_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    decided_at TEXT",          "position": 5        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 6        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 7        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 8        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 9        }      ],      "constraints": [        {          "declaration": "\n    CHECK (length(title) > 0)",          "position": 10        },        {          "declaration": "\n    CHECK (length(items) > 0)",          "position": 11        },        {          "declaration": "\n    CHECK (status IN ('open', 'approved', 'declined'))",          "position": 12        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n  ",          "position": 13        }      ],      "prefix": "CREATE TABLE IF NOT EXISTS cotton_placement_proposals (",      "suffix": ")",      "indexes": [        "CREATE INDEX IF NOT EXISTS idx_cotton_placement_proposals_author ON cotton_placement_proposals (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ],  "card": {    "face": "plain",    "fields": [      {        "slot": "title",        "column": "title"      },      {        "slot": "subtitle",        "column": "count"      },      {        "slot": "body",        "column": "items"      },      {        "slot": "facts",        "column": "created_at"      }    ]  },  "picture": null,  "engine": "placements",  "project": null,  "order": null,  "slip": {    "title": "title",    "subtitle": "count",    "trailing": null,    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "title",        "count",        "items",        "created_at"      ]    }  ],  "add": false,  "scope": "personal",  "setup": true,  "empty": {    "title": "No proposals yet"  },  "delete": false,  "commands": [    {      "id": "approve",      "label": "Approve",      "kind": "update",      "method": "vault.approvePlacements",      "bindings": {        "id": "$id"      },      "receipt": "Approved",      "does": "completes"    },    {      "id": "decline",      "label": "Decline",      "kind": "update",      "method": "vault.declinePlacements",      "bindings": {        "id": "$id"      },      "receipt": "Declined",      "does": "puts-away"    }  ]}