refactor: BOM 시스템 정리 및 API 구조 최적화
## 주요 변경사항 ### BOM 시스템 통합 및 정리 - 기본 BOM 시스템 완전 제거 (미완성 3-tier 구조) - app/Http/Controllers/Api/V1/BomController.php 삭제 - app/Services/BomService.php 삭제 - app/Models/Products/Bom.php 삭제 - app/Models/Products/BomItem.php 삭제 - BOM 역할 명확화: Product BOM (운영용) + Design BOM (설계용) - Tag 모델에서 불필요한 BOM 참조 제거 ### API 그룹핑 최적화 - Products & Materials 통합: /v1/products/materials/* - Settings & Configuration 통합: /v1/settings/* - 필드 설정: /v1/settings/fields/* - 옵션 관리: /v1/settings/options/* - 공통 코드: /v1/settings/common/* - 기존 분산된 라우트 통합으로 일관성 향상 ### 번역 완성도 향상 - 영어 에러 메시지 누락 항목 추가 - Settings, Materials, File 관련 메시지 보완 - 한국어/영어 번역 파일 동기화 완료 ### 시스템 품질 개선 - API 구조 논리적 재구성으로 사용자 경험 향상 - 코드 복잡도 감소 및 유지보수성 개선 - 불필요한 컨트롤러/서비스 제거로 시스템 단순화 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\BomService;
|
||||
use App\Helpers\ApiResponse;
|
||||
|
||||
class BomController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return BomService::getBoms($request);
|
||||
}, 'BOM 목록 조회');
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return BomService::setBom($request);
|
||||
}, 'BOM 등록');
|
||||
}
|
||||
|
||||
|
||||
public function show(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return BomService::getBom($request);
|
||||
}, '특정BOM 상세 조회');
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return BomService::updateBom($request);
|
||||
}, 'BOM 수정');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return BomService::destoryBom($request);
|
||||
}, 'BOM 삭제');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\ModelService;
|
||||
use App\Helpers\ApiResponse;
|
||||
|
||||
class ModelController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return ModelService::getModels($request);
|
||||
}, '모델 목록 조회');
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
return ModelService::setModel($request);
|
||||
}, '모델 등록');
|
||||
}
|
||||
|
||||
|
||||
public function show(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
return ModelService::getModel($id);
|
||||
}, '특정모델 상세 조회');
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
return ModelService::updateModel($id);
|
||||
}, '모델 수정');
|
||||
}
|
||||
|
||||
|
||||
public function destroy(Request $request, int $id)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($id) {
|
||||
return ModelService::destoryModel($id);
|
||||
}, '모델 삭제');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Models\Commons;
|
||||
|
||||
use App\Models\Materials\Material;
|
||||
use App\Models\Products\Bom;
|
||||
use App\Models\Products\Part;
|
||||
use App\Models\Products\Product;
|
||||
use App\Models\Tenants\Tenant;
|
||||
@@ -49,11 +48,4 @@ public function materials(): MorphToMany
|
||||
return $this->morphedByMany(Material::class, 'taggable');
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM(Bill of Materials)와 연결 (N:M, 폴리모픽)
|
||||
*/
|
||||
public function boms(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(Bom::class, 'taggable');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Commons\Tag;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperBom
|
||||
*/
|
||||
class Bom extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $fillable = ['tenant_id','product_id','code','name','category_id','attributes','description','is_default','is_active','image_file_id'];
|
||||
|
||||
public function product() {
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
public function category() {
|
||||
return $this->belongsTo(CommonCode::class, 'category_id');
|
||||
}
|
||||
public function items() {
|
||||
return $this->hasMany(BomItem::class);
|
||||
}
|
||||
public function image() {
|
||||
return $this->belongsTo(File::class, 'image_file_id');
|
||||
}
|
||||
|
||||
// 파일 목록 (N:M, 폴리모픽)
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
// 태그 목록 (N:M, 폴리모픽)
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperBomItem
|
||||
*/
|
||||
class BomItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $fillable = ['tenant_id','bom_id','parent_id','item_type','ref_id','quantity','attributes','sort_order'];
|
||||
|
||||
public function bom() {
|
||||
return $this->belongsTo(Bom::class);
|
||||
}
|
||||
public function parent() {
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
public function children() {
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Products\Bom;
|
||||
|
||||
class BomService
|
||||
{
|
||||
public static function getBoms()
|
||||
{
|
||||
$query = new Bom();
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function setBom()
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function getBom(int $id)
|
||||
{
|
||||
$query = Bom::find($id);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function updateBom(int $id)
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function destoryBom(int $id)
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Products\Bom;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Products\Product;
|
||||
|
||||
class ModelService
|
||||
{
|
||||
public static function getModels()
|
||||
{
|
||||
$query = new Product();
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function setModel()
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function getModel(int $id)
|
||||
{
|
||||
$query = Bom::find($id);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function updateModel(int $id)
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public static function destoryModel(int $id)
|
||||
{
|
||||
$query = DB::table('COM_CODE')
|
||||
->select(['CODE_TP_ID', 'CODE_ID', 'CODE_VAL', 'CODE_DESC', 'USE_YN']);
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user