feat: implement payout system database schema and models

This commit is contained in:
kbe
2025-09-16 23:52:26 +02:00
parent e5ed1a34dd
commit 0399761fb3
23 changed files with 421 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ class User < ApplicationRecord
has_many :events, dependent: :destroy
has_many :tickets, dependent: :destroy
has_many :orders, dependent: :destroy
has_many :earnings, dependent: :destroy
# Validations - allow reasonable name lengths
validates :last_name, length: { minimum: 2, maximum: 50, allow_blank: true }
@@ -48,4 +49,21 @@ class User < ApplicationRecord
# Alias for can_manage_events? to make views more semantic
can_manage_events?
end
def name
[ first_name, last_name ].compact.join(" ").strip
end
# Stripe Connect methods
def stripe_account_id
stripe_connected_account_id
end
def has_stripe_account?
stripe_connected_account_id.present?
end
def can_receive_payouts?
has_stripe_account? && promoter?
end
end