feat(server): evaluate price alerts per product and fix gold discharge rounding

Alerts now bind to a product_id and share one evaluator; displayed gold within a rounding step discharges the full wallet.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 22:23:20 +03:30
co-authored by Cursor
parent 341b2da2c9
commit b0296c6e94
10 changed files with 454 additions and 55 deletions
@@ -0,0 +1,34 @@
<?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
{
if (! Schema::hasTable('price_triggers')) {
return;
}
Schema::table('price_triggers', function (Blueprint $table) {
if (! Schema::hasColumn('price_triggers', 'product_id')) {
$table->unsignedBigInteger('product_id')->nullable()->after('customer_id');
$table->index('product_id');
}
});
}
public function down(): void
{
if (! Schema::hasTable('price_triggers') || ! Schema::hasColumn('price_triggers', 'product_id')) {
return;
}
Schema::table('price_triggers', function (Blueprint $table) {
$table->dropIndex(['product_id']);
$table->dropColumn('product_id');
});
}
};