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

@@ -23,6 +23,7 @@ class Purchase extends Model
'status',
'purchase_type',
'withdrawal_id',
'approval_id',
'tax_invoice_received',
'created_by',
'updated_by',
@@ -58,6 +59,7 @@ class Purchase extends Model
'total_amount' => 'decimal:2',
'client_id' => 'integer',
'withdrawal_id' => 'integer',
'approval_id' => 'integer',
'tax_invoice_received' => 'boolean',
];
@@ -85,6 +87,14 @@ public function withdrawal(): BelongsTo
return $this->belongsTo(Withdrawal::class);
}
/**
* 연결된 품의서/지출결의서
*/
public function approval(): BelongsTo
{
return $this->belongsTo(Approval::class);
}
/**
* 생성자 관계
*/