Phase 7: 24h retention TTL + platform-admin panel for creating orgs - #21
Closed
ArneeMe wants to merge 1 commit into
Closed
Phase 7: 24h retention TTL + platform-admin panel for creating orgs#21ArneeMe wants to merge 1 commit into
ArneeMe wants to merge 1 commit into
Conversation
Retention: unprocessed submissions now expire 24 hours after creation. A lazy sweep (delete where created_at < now - TTL) runs whenever the submissions API is touched — no scheduler needed on the edge runtime, and if nothing triggers it, nothing is reading the data either. The dashboard shows 'Slettes automatisk om X t' per card, the volunteer confirmation screen explains the expiry, and CLAUDE.md documents the guarantee. TTL is a single constant in src/util/retention.ts. Platform admin: /admin lets allowlisted accounts (PLATFORM_ADMIN_EMAILS env, comma-separated — unset disables the surface) list orgs and create a new org with its first member in one Hasura transaction (client- generated uuid ties the two inserts together). The email check reads auth.users server-side, never client input. scripts/create-org.ts remains for CLI use. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB
Deploying inf319-certificate with
|
| Latest commit: |
905f86e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://75dcc133.inf319-certificate.pages.dev |
| Branch Preview URL: | https://claude-phase-7-retention-adm.inf319-certificate.pages.dev |
Owner
Author
|
Superseded by the review-ordered stack #25 → #29 (retention TTL wiring + /admin panel landed in #29; the pure TTL math with tests in #25). Closing. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #20 (chain: #16 → #17 → #20 → this). Retarget bases downward as parents merge.
Retention: submissions expire after 24 hours
SUBMISSION_TTL_HOURSinsrc/util/retention.ts) — change it there if 24h proves too aggressive for weekend-paced orgs. Phase 4: ops polish — optional admin notifications, robots.txt #18's email notification is what makes a short TTL comfortable in practice.Platform-admin panel: create orgs without SQL
/adminlists all organizations and creates a new one with its first member attached — org row + membership in one Hasura transaction (client-generated uuid ties the two inserts).PLATFORM_ADMIN_EMAILS(comma-separated account emails; unset = the whole surface is disabled). The check reads the caller's email fromauth.usersserver-side — never from client input — and it's deliberately not a database role, so it can't be self-granted through any app surface./registrer→ you create the org at/adminwith their email → they invite colleagues via Medlemmer. Zero SQL.scripts/create-org.tsremains for CLI use.Deploy notes
PLATFORM_ADMIN_EMAILSin Cloudflare Pages (e.g. your own email) to enable/admin./adminto the robots.txt disallow list (robots.ts lives in the other stack — one-line follow-up).Verification
/adminsmoke-rendered on the dev server./admin, confirm an old submission disappears after the sweep triggers.🤖 Generated with Claude Code
https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB
Generated by Claude Code