Phase 10, part 7: posting accounts, and who may post to which

Social accounts become posting accounts: several per network, the
company's and each person's own, with their tokens kept per account. The
old sign-ins are adopted as the company's. Admins say who may post to which
(Settings → Posting accounts); a draft can go out from one account or a
copy to several, each recording who posted it and as what. Signing an
account out, or removing its owner, holds the posts scheduled to it and
tells whoever scheduled them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:26:34 -07:00
co-authored by Claude Opus 5.5
parent a4dd36f5a4
commit bb4772637c
31 changed files with 1758 additions and 325 deletions
+25
View File
@@ -120,6 +120,31 @@ CREATE TABLE throttle (
count INTEGER NOT NULL DEFAULT 0,
since TEXT NOT NULL -- when the count started
);
`,
},
// 35
{
Note: "posting accounts (several per network, the company's and people's own), who may post to them, and who wrote and posted each draft",
SQLite: `
CREATE TABLE posting_accounts (
id INTEGER PRIMARY KEY,
network TEXT NOT NULL, -- x, linkedin, linkedin_page, reddit
name TEXT NOT NULL DEFAULT '', -- as shown: @acme, u/jo, the page's or the member's name
external TEXT NOT NULL DEFAULT '', -- the network's ID for it: a URN, a username
owner_id INTEGER NOT NULL DEFAULT 0, -- 0: the company's; else the user whose own account it is
created_by INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL,
expires_at TEXT NOT NULL DEFAULT '' -- when the sign-in runs out (LinkedIn); '' if renewed
);
CREATE TABLE posting_grants (
account_id INTEGER NOT NULL REFERENCES posting_accounts(id) ON DELETE CASCADE,
user_id INTEGER NOT NULL,
PRIMARY KEY (account_id, user_id)
);
ALTER TABLE drafts ADD COLUMN account_id INTEGER NOT NULL DEFAULT 0; -- 0: the company's account for the channel
ALTER TABLE drafts ADD COLUMN written_by INTEGER NOT NULL DEFAULT 0;
ALTER TABLE drafts ADD COLUMN posted_by INTEGER NOT NULL DEFAULT 0;
ALTER TABLE drafts ADD COLUMN posted_as TEXT NOT NULL DEFAULT ''; -- the account it went out as, when it did
`,
},
}