Add sports-match type, device tracking, profile visits, and share refactor
- New SportsMatch model/controller and sports UI components/modal - Move share-modal to a reusable x-share-modal/x-share-button component - Add VideoSharedWithUser notification and share-to-members flow - Device/user-agent tracking on views, downloads, share accesses - ProfileVisit model + migration; subscription source tracking - Email thumbnail support; remove stale TODO files
This commit is contained in:
1 parent
6aae6f86b6
commit
73527f3781
61 files changed
+4014
-636
No files matched your search
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sports_matches', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// A match always belongs to a video (type=match) and its creator.
|
||||
$table->foreignId('video_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
|
||||
// draft | published — lets uploaders save basic info and finish later.
|
||||
$table->string('status', 20)->default('draft')->index();
|
||||
|
||||
// ── Basic fields (shown first; only title is required for a draft) ───
|
||||
$table->string('title'); // match title (required)
|
||||
$table->string('event_name')->nullable();
|
||||
$table->date('match_date')->nullable();
|
||||
$table->time('match_time')->nullable();
|
||||
$table->string('participant1_name')->nullable();
|
||||
$table->string('participant2_name')->nullable();
|
||||
$table->string('referee_name')->nullable();
|
||||
// ── Fields revealed later when editing ──────────────────────────────
|
||||
$table->string('sport', 80)->nullable()->index();
|
||||
$table->string('match_type', 80)->nullable();
|
||||
$table->string('venue_name')->nullable();
|
||||
|
||||
// ── Optional groups (progressive disclosure) stored as JSON ──────────
|
||||
$table->json('competition')->nullable(); // name, type, stage, season, organizer, championship_name
|
||||
$table->json('participants')->nullable(); // p1_*/p2_* details, weight_class, gender_division, level, extra[]
|
||||
$table->json('media')->nullable(); // image paths + caption, alt, credit, public
|
||||
$table->json('officials')->nullable(); // [{ role, name, photo }]
|
||||
$table->json('venue')->nullable(); // address, city, country, lat, lng, notes
|
||||
$table->json('result')->nullable(); // winner, outcome_type, final_result, rank, notes
|
||||
$table->json('segments')->nullable(); // [{ type, number, score, winner, notes }]
|
||||
$table->json('statistics')->nullable(); // [{ name, value, owner, notes }]
|
||||
$table->json('reviews')->nullable(); // review_type, requested_by, review_result, source_url, verification_notes, admin_notes
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sports_matches');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->string('user_agent', 512)->nullable()->after('country_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->dropColumn('user_agent');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->string('device_id', 64)->nullable()->after('user_agent');
|
||||
$table->index(['video_id', 'device_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->dropIndex(['video_id', 'device_id']);
|
||||
$table->dropColumn('device_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('video_downloads', function (Blueprint $table) {
|
||||
$table->string('user_agent', 512)->nullable()->after('country_name');
|
||||
});
|
||||
|
||||
Schema::table('share_accesses', function (Blueprint $table) {
|
||||
$table->string('user_agent', 512)->nullable()->after('country_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('video_downloads', function (Blueprint $table) {
|
||||
$table->dropColumn('user_agent');
|
||||
});
|
||||
Schema::table('share_accesses', function (Blueprint $table) {
|
||||
$table->dropColumn('user_agent');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->string('device_hash', 64)->nullable()->after('device_id');
|
||||
$table->index(['video_id', 'device_hash']);
|
||||
});
|
||||
|
||||
Schema::table('video_downloads', function (Blueprint $table) {
|
||||
$table->string('device_hash', 64)->nullable()->after('user_agent');
|
||||
});
|
||||
|
||||
Schema::table('share_accesses', function (Blueprint $table) {
|
||||
$table->string('device_hash', 64)->nullable()->after('user_agent');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->dropIndex(['video_id', 'device_hash']);
|
||||
$table->dropColumn('device_hash');
|
||||
});
|
||||
Schema::table('video_downloads', function (Blueprint $table) {
|
||||
$table->dropColumn('device_hash');
|
||||
});
|
||||
Schema::table('share_accesses', function (Blueprint $table) {
|
||||
$table->dropColumn('device_hash');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->unsignedInteger('watched_seconds')->default(0)->after('country_name');
|
||||
$table->boolean('completed')->default(false)->after('watched_seconds');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('video_views', function (Blueprint $table) {
|
||||
$table->dropColumn(['watched_seconds', 'completed']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('profile_visits', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('profile_user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->foreignId('visitor_user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('device_id', 64)->nullable();
|
||||
$table->foreignId('source_video_id')->nullable()->constrained('videos')->nullOnDelete();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->string('country', 2)->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
$table->index(['profile_user_id', 'created_at']);
|
||||
$table->index('source_video_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('profile_visits');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('user_subscriptions', function (Blueprint $table) {
|
||||
$table->foreignId('source_video_id')->nullable()->after('channel_id')
|
||||
->constrained('videos')->nullOnDelete();
|
||||
$table->index('source_video_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_subscriptions', function (Blueprint $table) {
|
||||
$table->dropForeign(['source_video_id']);
|
||||
$table->dropIndex(['source_video_id']);
|
||||
$table->dropColumn('source_video_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user