Skip to content

feat: add get-or-create helpers for clerk users - #116

Open
T04STER wants to merge 1 commit into
iloveitaly:masterfrom
T04STER:feat/clerk-user-helpers
Open

T04STER wants to merge 1 commit into
iloveitaly:masterfrom
T04STER:feat/clerk-user-helpers

Conversation

@T04STER

@T04STER T04STER commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Pulls up a small set of Clerk user helpers from a downstream project, as requested in review there.

app/helpers/clerk.py adds three functions:

  • clerk_user_exists(email) — whether a Clerk account already exists for an email
  • get_or_create_clerk_user(email, *, password=None) — the Clerk-side get-or-create
  • get_or_create_user_from_email(email) — resolves a local User, creating both the Clerk account and the linked record if either is missing

Resolving a local User from an email comes up in any flow that has an email before it has a user (an order, an API request, an invite), and it needs to be idempotent so it can be called repeatedly for the same address. app/factories/clerk.py already covers the dev/seed variant of this; this is the general one for application code.

Both public entry points use the get_or_create_ prefix so the naming stays consistent across the module.

No existing files are touched — it imports only app.log, app.configuration.clerk.clerk, and app.models.user.User, all of which the template already has.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GsmJFxRzjUGoXsVqEoPcYG

Resolving a local User for an email address -- creating the Clerk account
and the linked User record if either is missing -- comes up in any flow
that has an email before it has a user (an order, an API request, an
invite). app/factories/clerk.py covers the dev/seed variant of this, but
there was no general helper for application code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GsmJFxRzjUGoXsVqEoPcYG
@T04STER
T04STER force-pushed the feat/clerk-user-helpers branch from d85cd83 to facb870 Compare September 8, 2026 09:22
@T04STER T04STER changed the title feat: add find-or-create helpers for clerk users feat: add get-or-create helpers for clerk users Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant