feat: [loan] 상품권 접대비 자동 연동 기능 추가

- ExpenseAccount: loan_id 필드 + SUB_TYPE_GIFT_CERTIFICATE 상수 추가
- LoanService: 상품권 used+접대비해당 시 expense_accounts 자동 upsert/삭제
- 마이그레이션: expense_accounts에 loan_id 컬럼 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
유병철
2026-03-05 21:22:44 +09:00
parent 8c9f2fcfb5
commit 31d2f08dd8
3 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('expense_accounts', function (Blueprint $table) {
$table->unsignedBigInteger('loan_id')->nullable()->after('card_no')
->comment('연결된 가지급금 ID (상품권→접대비 전환 시)');
$table->index('loan_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('expense_accounts', function (Blueprint $table) {
$table->dropIndex(['loan_id']);
$table->dropColumn('loan_id');
});
}
};