feat: 매입관리 품의서/지출결의서 연동 기능 추가

- purchases 테이블에 approval_id 컬럼 추가 (마이그레이션)
- Purchase 모델에 approval 관계 정의
- PurchaseService에서 approval 데이터 eager loading 구현
- FormRequest에 approval_id 유효성 검증 추가
- Swagger 문서에 approval 관련 스키마 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 22:47:25 +09:00
parent 9197fe66f7
commit 7162fc2b46
6 changed files with 257 additions and 4 deletions

View File

@@ -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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('purchases', function (Blueprint $table) {
$table->unsignedBigInteger('approval_id')
->nullable()
->after('withdrawal_id')
->comment('연결된 품의서/지출결의서 ID');
$table->index('approval_id', 'idx_approval');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('purchases', function (Blueprint $table) {
$table->dropIndex('idx_approval');
$table->dropColumn('approval_id');
});
}
};