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

16
app/models/earning.rb Normal file
View File

@@ -0,0 +1,16 @@
class Earning < ApplicationRecord
# === Relations ===
belongs_to :event
belongs_to :user
belongs_to :order
# === Enums ===
enum :status, { pending: 0, paid: 1 }
# === Validations ===
validates :amount_cents, presence: true, numericality: { greater_than_or_equal_to: 0 }
validates :fee_cents, presence: true, numericality: { greater_than_or_equal_to: 0 }
validates :net_amount_cents, numericality: { greater_than_or_equal_to: 0, allow_nil: true }
validates :status, presence: true
validates :stripe_payout_id, allow_blank: true, uniqueness: true
end