{ "format_version": 1, "id": "person_handle", "name": "Handle", "plural": "Handles", "builtin": true, "visibility": "owner", "title": "value", "columns": [ { "key": "person_id", "name": "Person", "type": "link", "link_to": "person", "required": true, "contributes": false }, { "key": "kind", "name": "Kind", "type": "choice", "choices": [ "phone", "email", "instagram", "facebook", "linkedin" ], "labels": { "phone": "Phone", "email": "Email", "instagram": "Instagram", "facebook": "Facebook", "linkedin": "LinkedIn" }, "required": true }, { "key": "value", "name": "Handle", "type": "text", "required": true }, { "key": "normalised", "name": "Matched as", "type": "text", "readonly": true }, { "key": "source", "name": "From", "type": "text", "readonly": true }, { "key": "verified_at", "name": "Confirmed", "type": "date", "readonly": true }, { "key": "position", "name": "Position", "type": "number", "readonly": true }, { "key": "trashed_at", "type": "date", "format": "calendar-datetime", "readonly": true }, { "key": "kept", "name": "Confirmed", "type": "bool" } ], "instructions": "A handle is one address a person can be reached by. Use phone for a number, including WhatsApp, email for an email address, or the social site kind. Never create a second person or merge conversations to keep a handle. A normalized handle belongs to only one person in this database. Keep confirms this address; Remove removes only the address, leaving the person and conversations. To correct an address, remove it and add the correct one.", "tables": [ { "name": "cotton_person_handles", "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": "person_id", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n person_id TEXT NOT NULL", "position": 2 }, { "name": "kind", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n kind TEXT NOT NULL CHECK (kind IN ('phone','email','instagram','facebook','linkedin'))", "position": 3 }, { "name": "value", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n value TEXT NOT NULL CHECK (length(trim(value)) > 0)", "position": 4 }, { "name": "normalised", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n normalised TEXT NOT NULL CHECK (length(normalised) > 0)", "position": 5 }, { "name": "source", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n source TEXT NOT NULL CHECK (source IN ('manual','contacts','import','suggestion','whatsapp','instagram','facebook','linkedin'))", "position": 6 }, { "name": "verified_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n verified_at TEXT", "position": 7 }, { "name": "position", "type": "INTEGER", "default": "0", "nullable": false, "primary_key": false, "declaration": "\n position INTEGER NOT NULL DEFAULT 0", "position": 8 }, { "name": "created_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n created_at TEXT NOT NULL", "position": 9 }, { "name": "updated_at", "type": "TEXT", "default": null, "nullable": false, "primary_key": false, "declaration": "\n updated_at TEXT NOT NULL", "position": 10 }, { "name": "_hlc", "type": "TEXT", "default": "''", "nullable": false, "primary_key": false, "declaration": "\n _hlc TEXT NOT NULL DEFAULT ''", "position": 11 }, { "name": "_born", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": "\n _born TEXT", "position": 12 }, { "name": "trashed_at", "type": "TEXT", "default": null, "nullable": true, "primary_key": false, "declaration": " trashed_at TEXT", "position": 13 } ], "constraints": [ { "declaration": "\n FOREIGN KEY (person_id) REFERENCES cotton_people(id)", "position": 14 }, { "declaration": "\n FOREIGN KEY (workspace_id) REFERENCES cotton_workspaces(id) ON DELETE CASCADE\n ", "position": 15 } ], "prefix": "CREATE TABLE IF NOT EXISTS cotton_person_handles (", "suffix": ")", "indexes": [ "CREATE INDEX IF NOT EXISTS idx_cotton_person_handles_author ON cotton_person_handles (substr(_hlc, 20), _hlc)", "CREATE UNIQUE INDEX uq_cotton_person_handles_handle ON cotton_person_handles (workspace_id, kind, normalised)", "CREATE INDEX idx_cotton_person_handles_person ON cotton_person_handles (person_id)" ], "full_text": [], "triggers": [] } ], "card": { "face": "plain", "fields": [ { "slot": "title", "column": "value" }, { "slot": "subtitle", "column": "kind" }, { "slot": "facts", "column": "source", "also": [ "verified_at" ] } ] }, "picture": null, "engine": "people", "date": null, "project": null, "order": null, "slip": { "title": "value", "subtitle": "kind", "trailing": null, "photo": null, "toggle": null }, "tile": { "face": "slip-list" }, "page": [ { "heading": null, "columns": [ "value", "kind", "person_id" ] }, { "heading": "Details", "columns": [ "source", "verified_at" ] } ], "readonly_when": "normalised", "sort": { "column": "position" }, "empty": { "title": "No handles yet.", "message": "Add a phone number, email address or social handle." }, "search": [ "value" ], "deletion": { "confirm": "Remove this handle from the person? Their conversations stay.", "label": "Remove", "asks": true }, "commands": [ { "id": "keep", "label": "Confirm handle", "kind": "update", "verb": "update_record", "data": { "table": "person_handle", "patch": { "kept": true } }, "bindings": { "id": "$id" }, "when": { "kept": false }, "receipt": "Handle confirmed", "undo": "unkeep", "does": "completes" }, { "id": "unkeep", "label": "Unconfirm", "kind": "update", "verb": "update_record", "data": { "table": "person_handle", "patch": { "kept": false } }, "bindings": { "id": "$id" }, "when": { "kept": true }, "receipt": "Confirmation removed", "undo": "keep", "object": "person" }, { "id": "remove", "label": "Remove", "kind": "delete", "verb": "delete_record", "data": { "table": "person_handle" }, "confirm": "Remove this handle from the person? Their conversations stay.", "bindings": { "id": "$id" }, "receipt": "Removed", "does": "destroys" }, { "id": "person", "label": "Open person", "kind": "open", "opens": "person_id" } ], "parts": { "shape": "sheet", "head": { "facts": [] }, "links": [], "lists": [], "acts": { "main": "keep", "more": [ "person" ], "away": "remove" }, "cards": [ { "column": "kind" }, { "column": "kept" }, { "column": "source" } ], "strip": [] } }