feat(server): store and apply negative special price profits

Keep signed buy/sell extras so discounts work on quotes and orders, and ignore the nested user clone in this repo.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-17 13:11:00 +03:30
co-authored by Cursor
parent bd8284e4f8
commit 7d405cb83b
6 changed files with 64 additions and 14 deletions
@@ -12,8 +12,8 @@ return new class extends Migration
Schema::create('customer_special_price_packages', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->unsignedBigInteger('profit_buy')->default(0);
$table->unsignedBigInteger('profit_sell')->default(0);
$table->bigInteger('profit_buy')->default(0);
$table->bigInteger('profit_sell')->default(0);
$table->boolean('show_product')->default(true);
$table->boolean('is_active')->default(true);
$table->timestamps();
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (! Schema::hasTable('customer_special_price_packages')) {
return;
}
DB::statement('ALTER TABLE customer_special_price_packages MODIFY profit_buy BIGINT NOT NULL DEFAULT 0');
DB::statement('ALTER TABLE customer_special_price_packages MODIFY profit_sell BIGINT NOT NULL DEFAULT 0');
}
public function down(): void
{
if (! Schema::hasTable('customer_special_price_packages')) {
return;
}
DB::statement('ALTER TABLE customer_special_price_packages MODIFY profit_buy BIGINT UNSIGNED NOT NULL DEFAULT 0');
DB::statement('ALTER TABLE customer_special_price_packages MODIFY profit_sell BIGINT UNSIGNED NOT NULL DEFAULT 0');
}
};