Browse Source

refactor: remove default discount, interest, and fine fields from UnitFinancial model and related requests/resources

alvesantos 22 hours ago
parent
commit
3c8ec1e491

+ 0 - 3
app/Http/Requests/UnitFinancialRequest.php

@@ -27,9 +27,6 @@ public function rules(): array
             'max_freeze_count'      => 'nullable|integer|min:0',
             'charge_roi'            => 'nullable|boolean',
             'charge_fnm'            => 'nullable|boolean',
-            'default_discount'      => 'nullable|numeric|min:0|max:100',
-            'default_interest'      => 'nullable|numeric|min:0',
-            'default_fine'          => 'nullable|numeric|min:0|max:100',
         ];
     }
 }

+ 0 - 3
app/Http/Resources/UnitFinancialResource.php

@@ -31,9 +31,6 @@ public function toArray(Request $request): array
             'max_freeze_count' => $this->max_freeze_count,
             'charge_roi'       => (bool) $this->charge_roi,
             'charge_fnm'       => (bool) $this->charge_fnm,
-            'default_discount' => $this->default_discount,
-            'default_interest' => $this->default_interest,
-            'default_fine'     => $this->default_fine,
             'created_at'       => Carbon::parse($this->created_at)->format('Y-m-d H:i:s'),
             'updated_at'       => Carbon::parse($this->updated_at)->format('Y-m-d H:i:s'),
         ];

+ 0 - 9
app/Models/UnitFinancial.php

@@ -30,9 +30,6 @@
  * @property int|null $max_freeze_count
  * @property bool $charge_roi
  * @property bool $charge_fnm
- * @property numeric|null $default_discount
- * @property numeric|null $default_interest
- * @property numeric|null $default_fine
  * @property-read \App\Models\Unit $unit
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial newModelQuery()
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial newQuery()
@@ -47,9 +44,6 @@
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereChargeFnm($value)
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereChargeRoi($value)
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereCreatedAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereDefaultDiscount($value)
- * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereDefaultFine($value)
- * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereDefaultInterest($value)
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereDeletedAt($value)
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereDueDate($value)
  * @method static \Illuminate\Database\Eloquent\Builder<static>|UnitFinancial whereFinancialEmail($value)
@@ -82,9 +76,6 @@ class UnitFinancial extends Model
         'max_freeze_count'  => 'integer',
         'charge_roi'        => 'boolean',
         'charge_fnm'        => 'boolean',
-        'default_discount'  => 'decimal:2',
-        'default_interest'  => 'decimal:2',
-        'default_fine'      => 'decimal:2',
         'created_at'        => 'datetime',
         'updated_at'        => 'datetime',
         'deleted_at'        => 'datetime',

+ 28 - 0
database/migrations/2026_08_18_000004_drop_default_charges_from_unit_financials.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+/**
+ * Desconto/Juros/Multa padrão da unidade saíram da tab Financeiro — nunca
+ * foram lidos em nenhum cálculo do sistema (só existiam nesse formulário).
+ */
+return new class extends Migration
+{
+    public function up(): void
+    {
+        Schema::table('unit_financials', function (Blueprint $table) {
+            $table->dropColumn(['default_discount', 'default_interest', 'default_fine']);
+        });
+    }
+
+    public function down(): void
+    {
+        Schema::table('unit_financials', function (Blueprint $table) {
+            $table->decimal('default_discount', 5, 2)->nullable();
+            $table->decimal('default_interest', 5, 2)->nullable();
+            $table->decimal('default_fine', 5, 2)->nullable();
+        });
+    }
+};