Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class AddTeamProfileAndRoster < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :teams, :description, :text
|
||||
|
||||
create_table :team_roster_members, id: :uuid do |t|
|
||||
t.references :team, null: false, foreign_key: true, type: :uuid
|
||||
t.string :category, null: false, default: "player"
|
||||
t.string :full_name, null: false
|
||||
t.string :role_label
|
||||
t.integer :jersey_number
|
||||
t.text :bio
|
||||
t.integer :position, null: false, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :team_roster_members, %i[team_id category position]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
class AddClubBillingAndDocuments < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
change_table :clubs, bulk: true do |t|
|
||||
t.string :billing_entity_type, default: "company", null: false
|
||||
t.string :billing_legal_name
|
||||
t.string :billing_vat_number
|
||||
t.string :billing_fiscal_code
|
||||
t.string :billing_email
|
||||
t.string :billing_phone
|
||||
t.string :billing_address_line
|
||||
t.string :billing_city
|
||||
t.string :billing_province, limit: 2
|
||||
t.string :billing_postal_code
|
||||
t.string :billing_country, default: "IT", null: false
|
||||
t.string :billing_recipient_code, limit: 7
|
||||
t.string :billing_pec
|
||||
end
|
||||
|
||||
create_table :billing_payments, id: :uuid do |t|
|
||||
t.references :club, null: false, foreign_key: true, type: :uuid
|
||||
t.string :stripe_invoice_id
|
||||
t.string :stripe_payment_intent_id
|
||||
t.string :stripe_charge_id
|
||||
t.integer :amount_cents, null: false
|
||||
t.string :currency, default: "eur", null: false
|
||||
t.string :status, default: "paid", null: false
|
||||
t.string :plan_slug
|
||||
t.string :description
|
||||
t.datetime :paid_at
|
||||
t.string :invoice_pdf_url
|
||||
t.string :receipt_url
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :billing_payments, :stripe_invoice_id, unique: true, where: "stripe_invoice_id IS NOT NULL"
|
||||
add_index :billing_payments, [:club_id, :paid_at]
|
||||
|
||||
create_table :billing_invoices, id: :uuid do |t|
|
||||
t.references :club, null: false, foreign_key: true, type: :uuid
|
||||
t.references :billing_payment, foreign_key: true, type: :uuid
|
||||
t.string :number, null: false
|
||||
t.date :issued_on, null: false
|
||||
t.integer :amount_cents, null: false
|
||||
t.string :currency, default: "eur", null: false
|
||||
t.string :status, default: "issued", null: false
|
||||
t.string :source, default: "aruba", null: false
|
||||
t.string :aruba_document_id
|
||||
t.text :notes
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :billing_invoices, [:club_id, :number], unique: true
|
||||
add_index :billing_invoices, [:club_id, :issued_on]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class AddRegiaTokenToStreamSessions < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
add_column :stream_sessions, :regia_token_digest, :string
|
||||
add_column :stream_sessions, :regia_token_expires_at, :datetime
|
||||
add_index :stream_sessions, :regia_token_digest, unique: true
|
||||
end
|
||||
end
|
||||
76
backend/db/schema.rb
generated
76
backend/db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_05_29_120000) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
@@ -51,6 +51,45 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
t.index ["username"], name: "index_admin_accounts_on_username", unique: true
|
||||
end
|
||||
|
||||
create_table "billing_invoices", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "club_id", null: false
|
||||
t.uuid "billing_payment_id"
|
||||
t.string "number", null: false
|
||||
t.date "issued_on", null: false
|
||||
t.integer "amount_cents", null: false
|
||||
t.string "currency", default: "eur", null: false
|
||||
t.string "status", default: "issued", null: false
|
||||
t.string "source", default: "aruba", null: false
|
||||
t.string "aruba_document_id"
|
||||
t.text "notes"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["billing_payment_id"], name: "index_billing_invoices_on_billing_payment_id"
|
||||
t.index ["club_id", "issued_on"], name: "index_billing_invoices_on_club_id_and_issued_on"
|
||||
t.index ["club_id", "number"], name: "index_billing_invoices_on_club_id_and_number", unique: true
|
||||
t.index ["club_id"], name: "index_billing_invoices_on_club_id"
|
||||
end
|
||||
|
||||
create_table "billing_payments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "club_id", null: false
|
||||
t.string "stripe_invoice_id"
|
||||
t.string "stripe_payment_intent_id"
|
||||
t.string "stripe_charge_id"
|
||||
t.integer "amount_cents", null: false
|
||||
t.string "currency", default: "eur", null: false
|
||||
t.string "status", default: "paid", null: false
|
||||
t.string "plan_slug"
|
||||
t.string "description"
|
||||
t.datetime "paid_at"
|
||||
t.string "invoice_pdf_url"
|
||||
t.string "receipt_url"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["club_id", "paid_at"], name: "index_billing_payments_on_club_id_and_paid_at"
|
||||
t.index ["club_id"], name: "index_billing_payments_on_club_id"
|
||||
t.index ["stripe_invoice_id"], name: "index_billing_payments_on_stripe_invoice_id", unique: true, where: "(stripe_invoice_id IS NOT NULL)"
|
||||
end
|
||||
|
||||
create_table "club_memberships", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "user_id", null: false
|
||||
t.uuid "club_id", null: false
|
||||
@@ -70,6 +109,19 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
t.string "secondary_color", default: "#ffffff", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "billing_entity_type", default: "company", null: false
|
||||
t.string "billing_legal_name"
|
||||
t.string "billing_vat_number"
|
||||
t.string "billing_fiscal_code"
|
||||
t.string "billing_email"
|
||||
t.string "billing_phone"
|
||||
t.string "billing_address_line"
|
||||
t.string "billing_city"
|
||||
t.string "billing_province", limit: 2
|
||||
t.string "billing_postal_code"
|
||||
t.string "billing_country", default: "IT", null: false
|
||||
t.string "billing_recipient_code", limit: 7
|
||||
t.string "billing_pec"
|
||||
end
|
||||
|
||||
create_table "device_states", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
@@ -175,8 +227,11 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
t.string "timeout_job_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "regia_token_digest"
|
||||
t.datetime "regia_token_expires_at"
|
||||
t.index ["match_id"], name: "index_stream_sessions_on_match_id"
|
||||
t.index ["publish_token"], name: "index_stream_sessions_on_publish_token", unique: true
|
||||
t.index ["regia_token_digest"], name: "index_stream_sessions_on_regia_token_digest", unique: true
|
||||
t.index ["status"], name: "index_stream_sessions_on_status"
|
||||
t.index ["user_id"], name: "index_stream_sessions_on_user_id"
|
||||
end
|
||||
@@ -213,6 +268,20 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
t.index ["token_digest"], name: "index_team_invitations_on_token_digest", unique: true
|
||||
end
|
||||
|
||||
create_table "team_roster_members", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "team_id", null: false
|
||||
t.string "category", default: "player", null: false
|
||||
t.string "full_name", null: false
|
||||
t.string "role_label"
|
||||
t.integer "jersey_number"
|
||||
t.text "bio"
|
||||
t.integer "position", default: 0, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["team_id", "category", "position"], name: "index_team_roster_members_on_team_id_and_category_and_position"
|
||||
t.index ["team_id"], name: "index_team_roster_members_on_team_id"
|
||||
end
|
||||
|
||||
create_table "teams", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "sport", default: "volleyball"
|
||||
@@ -222,6 +291,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
t.uuid "club_id", null: false
|
||||
t.string "primary_color"
|
||||
t.string "secondary_color"
|
||||
t.text "description"
|
||||
t.index ["club_id"], name: "index_teams_on_club_id"
|
||||
end
|
||||
|
||||
@@ -265,6 +335,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "billing_invoices", "billing_payments"
|
||||
add_foreign_key "billing_invoices", "clubs"
|
||||
add_foreign_key "billing_payments", "clubs"
|
||||
add_foreign_key "club_memberships", "clubs"
|
||||
add_foreign_key "club_memberships", "users"
|
||||
add_foreign_key "device_states", "stream_sessions"
|
||||
@@ -278,6 +351,7 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_27_160101) do
|
||||
add_foreign_key "subscriptions", "clubs"
|
||||
add_foreign_key "subscriptions", "plans"
|
||||
add_foreign_key "team_invitations", "teams"
|
||||
add_foreign_key "team_roster_members", "teams"
|
||||
add_foreign_key "teams", "clubs"
|
||||
add_foreign_key "user_teams", "teams"
|
||||
add_foreign_key "user_teams", "users"
|
||||
|
||||
Reference in New Issue
Block a user