Phase 8 and 9 marketplace matching

This commit is contained in:
Codex
2026-07-10 14:27:51 -05:00
parent 5009269907
commit 24f73084fa
21 changed files with 778 additions and 50 deletions
@@ -0,0 +1,65 @@
<?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('taxonomy_terms', function (Blueprint $table) {
$table->id();
$table->foreignId('parent_id')->nullable()->constrained('taxonomy_terms')->cascadeOnDelete();
$table->string('type');
$table->string('name');
$table->string('slug');
$table->text('description')->nullable();
$table->unsignedInteger('sort_order')->default(0);
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->unique(['type', 'slug']);
$table->index(['type', 'is_active', 'sort_order']);
});
Schema::create('provider_profile_taxonomy_term', function (Blueprint $table) {
$table->id();
$table->foreignId('provider_profile_id')->constrained()->cascadeOnDelete();
$table->foreignId('taxonomy_term_id')->constrained()->cascadeOnDelete();
$table->string('evidence_source')->default('self_declared');
$table->timestamps();
$table->unique(['provider_profile_id', 'taxonomy_term_id']);
});
Schema::table('provider_profiles', function (Blueprint $table) {
$table->unsignedTinyInteger('max_technician_level')->default(1)->after('service_area');
});
Schema::table('job_posts', function (Blueprint $table) {
$table->foreignId('work_category_id')->nullable()->after('service_category')->constrained('taxonomy_terms')->nullOnDelete();
$table->foreignId('work_specialty_id')->nullable()->after('work_category_id')->constrained('taxonomy_terms')->nullOnDelete();
$table->unsignedTinyInteger('required_technician_level')->default(1)->after('work_specialty_id');
$table->string('work_mode')->default('onsite')->after('required_technician_level');
$table->string('pay_type')->nullable()->after('work_mode');
$table->string('posted_terms_summary')->nullable()->after('pay_type');
});
}
public function down(): void
{
Schema::table('job_posts', function (Blueprint $table) {
$table->dropConstrainedForeignId('work_category_id');
$table->dropConstrainedForeignId('work_specialty_id');
$table->dropColumn(['required_technician_level', 'work_mode', 'pay_type', 'posted_terms_summary']);
});
Schema::table('provider_profiles', function (Blueprint $table) {
$table->dropColumn('max_technician_level');
});
Schema::dropIfExists('provider_profile_taxonomy_term');
Schema::dropIfExists('taxonomy_terms');
}
};
+137
View File
@@ -4,6 +4,7 @@ namespace Database\Seeders;
use App\Models\User;
use App\Models\JobPost;
use App\Models\TaxonomyTerm;
use App\Models\WorkOrder;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@@ -19,6 +20,8 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
$taxonomy = $this->seedTaxonomy();
$roles = ['admin', 'provider', 'buyer'];
foreach ($roles as $role) {
@@ -60,6 +63,7 @@ class DatabaseSeeder extends Seeder
'headline' => 'POS, networking, cabling, and onsite IT support',
'bio' => 'Demo provider profile for the technician-owned exchange.',
'service_area' => 'Central US with regional travel',
'max_technician_level' => 3,
'skills' => "POS\nNetworking\nStructured cabling\nPrinter support",
'services' => [
['name' => 'Smart hands dispatch', 'level' => 'experienced'],
@@ -92,6 +96,15 @@ class DatabaseSeeder extends Seeder
]
);
$providerProfile->taxonomyTerms()->syncWithoutDetaching([
$taxonomy['categories']['point-of-sale']->id => ['evidence_source' => 'self_declared'],
$taxonomy['categories']['server-networking']->id => ['evidence_source' => 'self_declared'],
$taxonomy['specialties']['pos']->id => ['evidence_source' => 'self_declared'],
$taxonomy['specialties']['wireless-networking']->id => ['evidence_source' => 'self_declared'],
$taxonomy['skills']['well-tooled-mobile']->id => ['evidence_source' => 'self_declared'],
$taxonomy['tools']['cable-tester']->id => ['evidence_source' => 'self_declared'],
]);
$providerProfile->externalImports()->updateOrCreate(
['platform' => 'Field Nation', 'external_id' => '172-630'],
[
@@ -140,14 +153,27 @@ class DatabaseSeeder extends Seeder
'buyer_id' => $buyer->id,
'status' => 'assigned',
'service_category' => 'POS',
'work_category_id' => $taxonomy['categories']['point-of-sale']->id,
'work_specialty_id' => $taxonomy['specialties']['pos']->id,
'required_technician_level' => 3,
'work_mode' => 'onsite',
'pay_type' => 'fixed',
'posted_terms_summary' => 'Two-hour minimum plus travel if needed',
'location' => 'Tulsa, OK',
'time_window' => 'Morning',
'scope' => 'Troubleshoot intermittent POS terminal connectivity.',
'primary_objective' => 'Restore intermittent POS terminal connectivity.',
'included_work' => 'Inspect lane cabling, network path, and terminal connectivity.',
'excluded_work' => 'No electrical work or ceiling cabling unless accepted as a change request.',
'closeout_conditions' => 'Buyer validates that the terminal remains online.',
'required_skills' => 'POS and basic networking',
'required_tools' => 'Laptop, patch cables, toner/probe',
'deliverables' => "Check in\nPhotos\nResolution notes",
'payment_terms' => 'Direct buyer/provider payment terms.',
'vendor_onboarding' => 'Buyer handles direct onboarding.',
'contact_certified' => true,
'scope_clarity_status' => 'clear',
'risk_flags' => [],
'visibility' => 'public',
]
);
@@ -174,6 +200,10 @@ class DatabaseSeeder extends Seeder
'deliverables_checklist' => $job->deliverables,
'scheduled_at' => $job->starts_at,
'appointment_window' => $job->time_window,
'scope_snapshot' => $job->scopeSnapshot(),
'contact_snapshot' => $job->contactSnapshot(),
'scope_clarity_status' => $job->scope_clarity_status,
'risk_flags' => $job->risk_flags,
'checklist_items' => ['Check in', 'Photos', 'Resolution notes'],
'required_evidence' => $job->deliverables,
'evidence_rules' => ['Arrival photo', 'Completion photo'],
@@ -196,4 +226,111 @@ class DatabaseSeeder extends Seeder
]
);
}
private function seedTaxonomy(): array
{
$categories = [
'access-alarms' => 'Access & Alarms',
'av-digital-signage' => 'A/V & Digital Signage',
'cameras' => 'Cameras',
'ev-equipment' => 'EV Equipment',
'fiber-cabling' => 'Fiber Cabling',
'kiosk-atm' => 'Kiosk / ATM',
'low-voltage-cabling' => 'Low Voltage Cabling',
'office-equipment' => 'Office Equipment',
'point-of-sale' => 'Point of Sale',
'retail-services' => 'Retail Services',
'server-networking' => 'Server & Networking',
'telecom' => 'Telecom',
'other-trades' => 'Other Trades',
];
$specialties = [
'pos' => ['Point of Sale', 'point-of-sale'],
'self-checkout' => ['Self-checkout', 'point-of-sale'],
'networking' => ['Networking', 'server-networking'],
'wireless-networking' => ['Wireless networking', 'server-networking'],
'server-storage' => ['Server/storage', 'server-networking'],
'low-voltage-runs' => ['Low voltage runs', 'low-voltage-cabling'],
'low-voltage-testing' => ['Low voltage testing', 'low-voltage-cabling'],
'fiber-testing' => ['Fiber testing', 'fiber-cabling'],
'pots' => ['POTS', 'telecom'],
'voip-sip' => ['VoIP/SIP', 'telecom'],
'digital-signage' => ['Digital signage', 'av-digital-signage'],
'ip-camera' => ['IP camera', 'cameras'],
'printer' => ['Printer', 'office-equipment'],
];
$skills = [
'well-tooled-mobile' => 'Well-tooled mobile',
'well-prepared' => 'Well-prepared',
'well-experienced' => 'Well-experienced',
'smart-hands-ready' => 'Smart-hands ready',
'independent-installer' => 'Independent installer',
'field-troubleshooter' => 'Field troubleshooter',
];
$tools = [
'laptop' => 'Laptop',
'cable-tester' => 'Cable tester',
'toner-probe' => 'Toner/probe',
'labeler' => 'Labeler',
'basic-hand-tools' => 'Basic hand tools',
];
$certifications = [
'low-voltage-license' => 'Low-voltage license',
'comptia-a-plus' => 'CompTIA A+',
'network-plus' => 'Network+',
'manufacturer-certification' => 'Manufacturer certification',
];
$categoryRecords = [];
foreach ($categories as $slug => $name) {
$categoryRecords[$slug] = TaxonomyTerm::updateOrCreate(
['type' => 'work_category', 'slug' => $slug],
['name' => $name, 'sort_order' => count($categoryRecords) + 1, 'is_active' => true]
);
}
$specialtyRecords = [];
foreach ($specialties as $slug => [$name, $parentSlug]) {
$specialtyRecords[$slug] = TaxonomyTerm::updateOrCreate(
['type' => 'work_specialty', 'slug' => $slug],
['name' => $name, 'parent_id' => $categoryRecords[$parentSlug]->id ?? null, 'sort_order' => count($specialtyRecords) + 1, 'is_active' => true]
);
}
$skillRecords = [];
foreach ($skills as $slug => $name) {
$skillRecords[$slug] = TaxonomyTerm::updateOrCreate(
['type' => 'skill', 'slug' => $slug],
['name' => $name, 'sort_order' => count($skillRecords) + 1, 'is_active' => true]
);
}
$toolRecords = [];
foreach ($tools as $slug => $name) {
$toolRecords[$slug] = TaxonomyTerm::updateOrCreate(
['type' => 'tool', 'slug' => $slug],
['name' => $name, 'sort_order' => count($toolRecords) + 1, 'is_active' => true]
);
}
$certificationRecords = [];
foreach ($certifications as $slug => $name) {
$certificationRecords[$slug] = TaxonomyTerm::updateOrCreate(
['type' => 'certification', 'slug' => $slug],
['name' => $name, 'sort_order' => count($certificationRecords) + 1, 'is_active' => true]
);
}
return [
'categories' => $categoryRecords,
'specialties' => $specialtyRecords,
'skills' => $skillRecords,
'tools' => $toolRecords,
'certifications' => $certificationRecords,
];
}
}