refactor: products/materials 테이블 및 관련 코드 삭제

- products, materials, product_components 테이블 삭제 마이그레이션
- FK 제약조건 정리 (orders, order_items, material_receipts, lots)
- 관련 Models 삭제: Product, Material, ProductComponent 등
- 관련 Controllers 삭제: ProductController, MaterialController, ProductBomItemController
- 관련 Services 삭제: ProductService, MaterialService, ProductBomService
- 관련 Requests, Swagger 파일 삭제
- 라우트 정리: /products, /materials 엔드포인트 제거

모든 품목 관리는 /items 엔드포인트로 통합됨
item_id_mappings 테이블에 ID 매핑 보존

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-14 00:20:09 +09:00
parent a486595d07
commit 039fd623df
23 changed files with 158 additions and 4111 deletions

View File

@@ -1,92 +0,0 @@
<?php
namespace App\Models\Products;
use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* 단가 변경 이력 모델
*
* @property int $id
* @property int $tenant_id
* @property int $price_id
* @property int $revision_number
* @property \Carbon\Carbon $changed_at
* @property int $changed_by
* @property string|null $change_reason
* @property array|null $before_snapshot
* @property array $after_snapshot
*/
class PriceRevision extends Model
{
use BelongsToTenant;
public $timestamps = false;
protected $fillable = [
'tenant_id',
'price_id',
'revision_number',
'changed_at',
'changed_by',
'change_reason',
'before_snapshot',
'after_snapshot',
];
protected $casts = [
'revision_number' => 'integer',
'changed_at' => 'datetime',
'before_snapshot' => 'array',
'after_snapshot' => 'array',
];
/**
* 단가 관계
*/
public function price(): BelongsTo
{
return $this->belongsTo(Price::class, 'price_id');
}
/**
* 변경자 관계
*/
public function changedByUser(): BelongsTo
{
return $this->belongsTo(\App\Models\Members\User::class, 'changed_by');
}
/**
* 변경된 필드 목록 추출
*/
public function getChangedFields(): array
{
if (! $this->before_snapshot) {
return array_keys($this->after_snapshot ?? []);
}
$changed = [];
foreach ($this->after_snapshot as $key => $newValue) {
$oldValue = $this->before_snapshot[$key] ?? null;
if ($oldValue !== $newValue) {
$changed[] = $key;
}
}
return $changed;
}
/**
* 특정 필드의 이전/이후 값
*/
public function getFieldChange(string $field): array
{
return [
'before' => $this->before_snapshot[$field] ?? null,
'after' => $this->after_snapshot[$field] ?? null,
];
}
}