Cotton code
317 lines · 6.2 KB · JSONRaw
{  "format_version": 1,  "id": "member",  "list_route": "/members",  "record_route": "/members/[id]",  "setup": true,  "name": "Member",  "plural": "Members",  "picture": {    "photo": "photo:98e96d625a49a4b44db982aba7703fbb139ed3a8b411e61f88045ebed3fab229",    "object": "tool-members",    "link_object": "people"  },  "builtin": true,  "engine": "members",  "polled": true,  "columns": [    {      "key": "name",      "type": "text",      "readonly": true    },    {      "key": "role",      "name": "May",      "type": "choice",      "choices": [        "owner",        "admin",        "member"      ],      "labels": {        "owner": "Owner",        "admin": "Admin",        "member": "Member"      },      "hints": {        "owner": "Made this database",        "admin": "Can admit and remove people",        "member": "Reads and writes everything here"      },      "readonly": true    },    {      "key": "fingerprint",      "name": "Key",      "type": "text",      "readonly": true    },    {      "key": "device_name",      "name": "Asking from",      "type": "text",      "readonly": true,      "shown_when": {        "column": "status",        "values": [          "waiting"        ]      }    },    {      "key": "device_fingerprint",      "name": "Their phone's key",      "type": "text",      "readonly": true,      "shown_when": {        "column": "status",        "values": [          "waiting"        ]      }    },    {      "key": "digits",      "name": "Code",      "type": "text",      "readonly": true,      "shown_when": {        "column": "status",        "values": [          "waiting"        ]      }    },    {      "key": "status",      "name": "Status",      "type": "choice",      "readonly": true,      "choices": [        "waiting",        "in"      ]    },    {      "key": "state",      "name": "State",      "type": "text",      "readonly": true    },    {      "key": "database",      "name": "Database",      "type": "text",      "readonly": true    },    {      "key": "database_name",      "name": "Joining",      "type": "text",      "readonly": true,      "shown_when": {        "column": "status",        "values": [          "waiting"        ]      }    },    {      "key": "asked_at",      "name": "Asking since",      "type": "date",      "readonly": true,      "shown_when": {        "column": "status",        "values": [          "waiting"        ]      }    }  ],  "title": "name",  "date": null,  "project": null,  "order": null,  "slip": {    "title": "name",    "subtitle": [      "role",      "status"    ],    "subtitle_first": true,    "trailing": null,    "photo": null,    "toggle": null,    "caption": {      "status": "state"    }  },  "slip_by": {    "column": "status",    "slips": {      "waiting": {        "title": "name",        "subtitle": "database_name",        "caption": {          "columns": [            "digits"          ],          "dates": [            "asked_at"          ]        }      }    }  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "name",        "role",        "device_name",        "device_fingerprint",        "digits",        "fingerprint"      ]    }  ],  "add": false,  "delete": false,  "empty": {    "title": "Only you",    "message": "Nobody else is in this database."  },  "group": {    "column": "status",    "sections": [      {        "heading": null,        "values": [          "in"        ]      },      {        "heading": "Asking to join",        "values": [          "waiting"        ]      }    ]  },  "instructions": "A member is a person admitted to this database besides the one reading it, with what they may do (owner, admin or member), or a person asking to join through an invite (status waiting, with the six digits their phone shows). Admitting a person, turning one away and removing one are the list's and the page's actions, never a column write; never admit or remove anyone without the owner.",  "create": {    "label": "Admit a person",    "path": "/members/admit"  },  "commands": [    {      "id": "admit",      "object": "done",      "label": "Admit",      "kind": "update",      "method": "pairing.approve",      "bindings": {        "pairingId": "$id",        "digits": "digits"      },      "when": {        "status": "waiting"      },      "receipt": "Admitted {name}",      "does": "completes"    },    {      "id": "decline",      "object": "block",      "label": "Turn away",      "kind": "update",      "method": "pairing.decline",      "bindings": {        "pairingId": "$id"      },      "when": {        "status": "waiting"      },      "receipt": "Turned away {name}",      "does": "puts-away"    },    {      "id": "remove",      "object": "unlink",      "label": "Remove",      "kind": "update",      "method": "databases.remove",      "bindings": {        "personKey": "$id"      },      "when": {        "status": "in",        "role": {          "not": "owner"        }      },      "destructive": true,      "confirm": "They stop seeing this database at once, on every device of theirs. To come back they need a new invite.",      "receipt": "Removed {name}",      "does": "destroys"    }  ],  "parts": {    "shape": "sheet",    "head": {      "facts": [        "role",        "device_name"      ],      "state": "state"    },    "links": [],    "lists": [],    "acts": {      "main": "admit",      "more": [        "decline"      ],      "away": "remove"    },    "cards": [      {        "column": "role"      },      {        "column": "device_name"      },      {        "column": "state"      },      {        "column": "device_fingerprint"      },      {        "column": "digits"      },      {        "column": "fingerprint"      }    ]  },  "tool": {    "name": "Members",    "key": "members",    "icon": "users",    "card_stock": "rose",    "route": "/members"  ,"purpose":"The people who can enter this database."},  "tables": [],  "sort": {    "column": "role",    "descending": true,    "tie": "name"  }}