#676 — Merchant Role Added

Repo: Twill-AI/facade State: closed | Status: done Assignee: nadddder, sparsh-twillpayments

Created: 2025-10-27 · Updated: 2025-10-31

Description

Implement merchant user authentication pattern following the partner-style approach (master tenant, row-level security).

  • Add merchant_id field to DbProfile table (nullable ForeignKey to DbMerchant)
  • Add merchant_id field to User entity
  • Create new Role.MERCHANT_USER enum value to grant access with PartnerGrantedFor
  • Update auth persistence to handle merchant user caching
  • Add merchant user to init_auth() flow
  • Write unit tests

AC:

  • Document the approach
  • Merchant users authenticate via Supabase JWT
  • Merchant users cannot access other merchants’ data
  • Auth tests pass

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets