Admin protetto, dashboard KPI e aggiornamenti sito marketing.
Login admin con cambio password, metriche server (CPU/RAM/disco/banda), grafici e statistiche streaming; sezione piani ridimensionata. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
21
backend/db/migrate/20260527130000_create_admin_accounts.rb
Normal file
21
backend/db/migrate/20260527130000_create_admin_accounts.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class CreateAdminAccounts < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
create_table :admin_accounts, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :username, null: false
|
||||
t.string :password_digest, null: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :admin_accounts, :username, unique: true
|
||||
|
||||
password_digest = BCrypt::Password.create("admin")
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO admin_accounts (id, username, password_digest, created_at, updated_at)
|
||||
VALUES (gen_random_uuid(), 'admin', #{connection.quote(password_digest)}, NOW(), NOW())
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :admin_accounts
|
||||
end
|
||||
end
|
||||
14
backend/db/schema.rb
generated
14
backend/db/schema.rb
generated
@@ -10,11 +10,19 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_05_26_120000) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_05_27_130000) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "admin_accounts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.string "username", null: false
|
||||
t.string "password_digest", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["username"], name: "index_admin_accounts_on_username", unique: true
|
||||
end
|
||||
|
||||
create_table "device_states", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "stream_session_id", null: false
|
||||
t.string "device_role", null: false
|
||||
@@ -149,7 +157,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_26_120000) do
|
||||
t.datetime "accepted_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "staff_kind", default: "transmission", null: false
|
||||
t.index ["team_id", "email"], name: "index_team_invitations_on_team_id_and_email"
|
||||
t.index ["team_id", "staff_kind"], name: "index_team_invitations_on_team_id_and_staff_kind"
|
||||
t.index ["team_id"], name: "index_team_invitations_on_team_id"
|
||||
t.index ["token_digest"], name: "index_team_invitations_on_token_digest", unique: true
|
||||
end
|
||||
@@ -168,6 +178,8 @@ ActiveRecord::Schema[7.2].define(version: 2026_05_26_120000) do
|
||||
t.string "role", default: "member", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "staff_kind"
|
||||
t.index ["team_id", "staff_kind"], name: "index_user_teams_on_team_id_and_staff_kind"
|
||||
t.index ["team_id"], name: "index_user_teams_on_team_id"
|
||||
t.index ["user_id", "team_id"], name: "index_user_teams_on_user_id_and_team_id", unique: true
|
||||
t.index ["user_id"], name: "index_user_teams_on_user_id"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
load Rails.root.join("db/seeds/plans.rb")
|
||||
|
||||
AdminAccount.find_or_create_by!(username: "admin") do |a|
|
||||
a.password = "admin"
|
||||
end
|
||||
|
||||
coach = User.find_or_create_by!(email: "coach@matchlivetv.test") do |u|
|
||||
u.name = "Coach Demo"
|
||||
u.password = "password123"
|
||||
|
||||
Reference in New Issue
Block a user