Add in-app Care Queue Engine (Phase 1 MVP).
Deploy Ladill Care / deploy (push) Successful in 1m28s

Issue, call-next, serve, and complete tickets locally so Care Pro no longer
needs QUEUE_API_* when CARE_QUEUE_DRIVER=native (default). Remote Ladill Queue
remains available for cutover; PHPUnit keeps the remote driver for existing fakes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 09:54:06 +00:00
co-authored by Cursor
parent ad04f0cec8
commit 6cf5a24019
19 changed files with 1355 additions and 55 deletions
@@ -0,0 +1,82 @@
<?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('care_service_queues', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->string('owner_ref', 64)->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('branch_id')->constrained('care_branches')->cascadeOnDelete();
$table->string('context', 64);
$table->string('name');
$table->string('prefix', 8);
$table->string('routing_mode', 32)->default('shared_pool');
$table->string('external_key')->nullable()->index();
$table->unsignedInteger('next_number')->default(1);
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->unique(['organization_id', 'branch_id', 'context']);
});
Schema::create('care_service_points', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->string('owner_ref', 64)->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('service_queue_id')->constrained('care_service_queues')->cascadeOnDelete();
$table->string('name');
$table->string('destination')->nullable();
$table->string('kind', 32)->default('default');
$table->unsignedBigInteger('ref_id')->nullable();
$table->string('staff_ref')->nullable();
$table->string('staff_display_name')->nullable();
$table->string('external_key')->nullable()->index();
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->unique(['service_queue_id', 'external_key']);
});
Schema::create('care_queue_tickets', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->string('owner_ref', 64)->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('service_queue_id')->constrained('care_service_queues')->cascadeOnDelete();
$table->foreignId('service_point_id')->nullable()->constrained('care_service_points')->nullOnDelete();
$table->string('ticket_number', 32);
$table->string('status', 32)->default('waiting')->index();
$table->string('priority', 32)->default('walk_in');
$table->string('source', 32)->default('api');
$table->string('customer_name')->nullable();
$table->string('customer_phone')->nullable();
$table->string('care_entity', 32)->nullable();
$table->string('care_entity_uuid', 36)->nullable()->index();
$table->unsignedBigInteger('care_entity_id')->nullable();
$table->unsignedBigInteger('visit_id')->nullable();
$table->json('metadata')->nullable();
$table->timestamp('called_at')->nullable();
$table->timestamp('serving_at')->nullable();
$table->timestamp('completed_at')->nullable();
$table->timestamps();
$table->index(['service_queue_id', 'status']);
$table->index(['service_point_id', 'status']);
});
}
public function down(): void
{
Schema::dropIfExists('care_queue_tickets');
Schema::dropIfExists('care_service_points');
Schema::dropIfExists('care_service_queues');
}
};