Cotton code
325 lines · 7.3 KB · JSONRaw
{  "format_version": 1,  "id": "alarm",  "name": "Alarm",  "plural": "Alarms",  "picture": {"photo": "photo:04683ef7030be89a5551052690689da8f33d7b480270399fe3aa897e0a15bf0b", "object": "tool-alarms"},  "builtin": true,  "links": [    {      "label": "Deleted",      "table": "bin",      "where": {        "table": "alarm"      }    }  ],  "deletion": {    "bin": true  },  "engine": "alarms",  "list_head": "next_alarm",  "columns": [    {      "key": "label",      "type": "text",      "placeholder": "Alarm",      "name": "Label"    },    {      "key": "time",      "name": "Time",      "type": "time",      "placeholder": "Pick a time"    },    {      "key": "repeat_days",      "name": "Repeats on",      "type": "choice",      "multiple": true,      "week": true,      "choices": [        "Mon",        "Tue",        "Wed",        "Thu",        "Fri",        "Sat",        "Sun"      ],      "placeholder": "Once"    },    {      "key": "hour",      "type": "number",      "readonly": true    },    {      "key": "minute",      "type": "number",      "readonly": true    },    {      "key": "enabled",      "name": "On",      "type": "bool",      "default": true    },    {      "key": "sound",      "type": "bool",      "default": true,      "name": "Sound"    }  ],  "title": "label",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "time",    "subtitle": "label",    "trailing": "repeat_days",    "photo": null,    "toggle": "enabled",    "toggle_style": "switch"  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "time",        "label",        "repeat_days",        "sound",        "enabled"      ]    }  ],  "sort": {    "column": "hour",    "tie": "minute"  },  "layout": "cards",  "grid": {    "columns": 2  },  "empty": {    "title": "No alarms yet.",    "message": "Pick a time, and the days it rings on."  },  "create": {    "label": "New alarm"  },  "instructions": "An alarm rings at a clock time: hour 0 to 23 and minute 0 to 59 in the device's local time. Repeat days list the weekdays it rings on; with none it rings once. Turn an alarm off rather than deleting it when the person may want it back.",  "parts": {    "shape": "sheet",    "head": {      "facts": []    },    "links": [],    "lists": [],    "acts": {      "more": [],      "away": "delete"    },    "cards": [  {    "column": "time"  },  {    "column": "repeat_days"  },  {    "column": "sound",    "object": "bell",    "switches": [      "sound",      "enabled"    ],    "caption": "{on} of {total} on",    "label": "Sound and alarm"  }]  },  "commands": [    {      "id": "delete",      "label": "Delete",      "kind": "delete",      "verb": "delete_record",      "data": {        "table": "alarm"      },      "bindings": {        "id": "$id"      },      "confirm": "Undo on the receipt brings it back.",      "receipt": "Deleted",      "does": "destroys"    }  ],  "tool": {    "name": "Alarms",    "key": "alarms",    "icon": "alarm-clock",    "card_stock": "sage",    "route": "/alarms",    "figures": [      {        "read": "liveAlarms",        "many": "{n} on"      }    ]  ,"purpose":"Your alarms and when they will ring."},  "tables": [    {      "name": "cotton_alarms",      "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": "label",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    label TEXT NOT NULL DEFAULT ''",          "position": 2        },        {          "name": "hour",          "type": "INTEGER",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    hour INTEGER NOT NULL",          "position": 3        },        {          "name": "minute",          "type": "INTEGER",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    minute INTEGER NOT NULL",          "position": 4        },        {          "name": "repeat_days",          "type": "TEXT",          "default": "'[]'",          "nullable": false,          "primary_key": false,          "declaration": "\n    repeat_days TEXT NOT NULL DEFAULT '[]'",          "position": 5        },        {          "name": "enabled",          "type": "INTEGER",          "default": "1",          "nullable": false,          "primary_key": false,          "declaration": "\n    enabled INTEGER NOT NULL DEFAULT 1",          "position": 6        },        {          "name": "sound",          "type": "INTEGER",          "default": "1",          "nullable": false,          "primary_key": false,          "declaration": "\n    sound INTEGER NOT NULL DEFAULT 1",          "position": 7        },        {          "name": "created_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    created_at TEXT NOT NULL",          "position": 8        },        {          "name": "updated_at",          "type": "TEXT",          "default": null,          "nullable": false,          "primary_key": false,          "declaration": "\n    updated_at TEXT NOT NULL",          "position": 9        },        {          "name": "_hlc",          "type": "TEXT",          "default": "''",          "nullable": false,          "primary_key": false,          "declaration": "\n    _hlc TEXT NOT NULL DEFAULT ''",          "position": 10        },        {          "name": "_born",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    _born TEXT",          "position": 11        },        {          "name": "trashed_at",          "type": "TEXT",          "default": null,          "nullable": true,          "primary_key": false,          "declaration": "\n    trashed_at TEXT",          "position": 12        }      ],      "constraints": [        {          "declaration": "\n    CHECK ((hour >= 0) AND (hour <= 23))",          "position": 13        },        {          "declaration": "\n    CHECK ((minute >= 0) AND (minute <= 59))",          "position": 14        },        {          "declaration": "\n    FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n  ",          "position": 15        }      ],      "prefix": "CREATE TABLE cotton_alarms (",      "suffix": ")",      "indexes": [        "CREATE INDEX idx_cotton_alarms_workspace ON cotton_alarms (workspace_id)",        "CREATE INDEX IF NOT EXISTS idx_cotton_alarms_author ON cotton_alarms (substr(_hlc, 20), _hlc)"      ],      "full_text": [],      "triggers": []    }  ]}