refactor: Controller에서 Swagger 어노테이션 분리

- EstimateController에서 Swagger 어노테이션 제거 → EstimateApi.php 생성
- CommonController에서 Swagger 어노테이션 제거 → CommonApi.php 업데이트
- TenantFieldSettingController에서 Swagger 어노테이션 제거 → TenantFieldSettingApi.php 생성
- Swagger 정책 준수: Controller는 비즈니스 로직만, Swagger는 별도 파일로 분리

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-21 03:56:48 +09:00
parent a79238558d
commit 1449683aae
6 changed files with 530 additions and 543 deletions

View File

@@ -9,9 +9,6 @@
use App\Services\Estimate\EstimateService;
use Illuminate\Http\Request;
/**
* @OA\Tag(name="Estimate", description="견적 관리 API")
*/
class EstimateController extends Controller
{
protected EstimateService $estimateService;
@@ -21,24 +18,6 @@ public function __construct(EstimateService $estimateService)
$this->estimateService = $estimateService;
}
/**
* @OA\Get(
* path="/v1/estimates",
* summary="견적 목록 조회",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="status", in="query", description="견적 상태", @OA\Schema(type="string")),
* @OA\Parameter(name="customer_name", in="query", description="고객명", @OA\Schema(type="string")),
* @OA\Parameter(name="model_set_id", in="query", description="모델셋 ID", @OA\Schema(type="integer")),
* @OA\Parameter(name="date_from", in="query", description="시작일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="date_to", in="query", description="종료일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="search", in="query", description="검색어", @OA\Schema(type="string")),
* @OA\Parameter(name="per_page", in="query", description="페이지당 항목수", @OA\Schema(type="integer", default=20)),
*
* @OA\Response(response=200, description="성공")
* )
*/
public function index(Request $request)
{
$estimates = $this->estimateService->getEstimates($request->all());
@@ -48,18 +27,6 @@ public function index(Request $request)
], __('message.fetched'));
}
/**
* @OA\Get(
* path="/v1/estimates/{id}",
* summary="견적 상세 조회",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
*
* @OA\Response(response=200, description="성공")
* )
*/
public function show($id)
{
$estimate = $this->estimateService->getEstimateDetail($id);
@@ -69,31 +36,6 @@ public function show($id)
], __('message.fetched'));
}
/**
* @OA\Post(
* path="/v1/estimates",
* summary="견적 생성",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(
* required={"model_set_id", "estimate_name", "parameters"},
*
* @OA\Property(property="model_set_id", type="integer", description="모델셋 ID"),
* @OA\Property(property="estimate_name", type="string", description="견적명"),
* @OA\Property(property="customer_name", type="string", description="고객명"),
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
* @OA\Property(property="parameters", type="object", description="견적 파라미터"),
* @OA\Property(property="notes", type="string", description="비고")
* )
* ),
*
* @OA\Response(response=201, description="생성 성공")
* )
*/
public function store(CreateEstimateRequest $request)
{
$estimate = $this->estimateService->createEstimate($request->validated());
@@ -103,32 +45,6 @@ public function store(CreateEstimateRequest $request)
], __('message.created'), 201);
}
/**
* @OA\Put(
* path="/v1/estimates/{id}",
* summary="견적 수정",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(
*
* @OA\Property(property="estimate_name", type="string", description="견적명"),
* @OA\Property(property="customer_name", type="string", description="고객명"),
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
* @OA\Property(property="parameters", type="object", description="견적 파라미터"),
* @OA\Property(property="status", type="string", description="견적 상태"),
* @OA\Property(property="notes", type="string", description="비고")
* )
* ),
*
* @OA\Response(response=200, description="수정 성공")
* )
*/
public function update(UpdateEstimateRequest $request, $id)
{
$estimate = $this->estimateService->updateEstimate($id, $request->validated());
@@ -138,18 +54,6 @@ public function update(UpdateEstimateRequest $request, $id)
], __('message.updated'));
}
/**
* @OA\Delete(
* path="/v1/estimates/{id}",
* summary="견적 삭제",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
*
* @OA\Response(response=200, description="삭제 성공")
* )
*/
public function destroy($id)
{
$this->estimateService->deleteEstimate($id);
@@ -157,31 +61,6 @@ public function destroy($id)
return ApiResponse::success([], __('message.deleted'));
}
/**
* @OA\Post(
* path="/v1/estimates/{id}/clone",
* summary="견적 복제",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(
* required={"estimate_name"},
*
* @OA\Property(property="estimate_name", type="string", description="새 견적명"),
* @OA\Property(property="customer_name", type="string", description="고객명"),
* @OA\Property(property="project_name", type="string", description="프로젝트명"),
* @OA\Property(property="notes", type="string", description="비고")
* )
* ),
*
* @OA\Response(response=201, description="복제 성공")
* )
*/
public function clone(Request $request, $id)
{
$request->validate([
@@ -198,29 +77,6 @@ public function clone(Request $request, $id)
], __('message.estimate.cloned'), 201);
}
/**
* @OA\Put(
* path="/v1/estimates/{id}/status",
* summary="견적 상태 변경",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="견적 ID", @OA\Schema(type="integer")),
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(
* required={"status"},
*
* @OA\Property(property="status", type="string", enum={"DRAFT","SENT","APPROVED","REJECTED","EXPIRED"}, description="변경할 상태"),
* @OA\Property(property="notes", type="string", description="상태 변경 사유")
* )
* ),
*
* @OA\Response(response=200, description="상태 변경 성공")
* )
*/
public function changeStatus(Request $request, $id)
{
$request->validate([
@@ -239,18 +95,6 @@ public function changeStatus(Request $request, $id)
], __('message.estimate.status_changed'));
}
/**
* @OA\Get(
* path="/v1/estimates/form-schema/{model_set_id}",
* summary="견적 폼 스키마 조회",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
*
* @OA\Response(response=200, description="성공")
* )
*/
public function getFormSchema($modelSetId)
{
$schema = $this->estimateService->getEstimateFormSchema($modelSetId);
@@ -260,28 +104,6 @@ public function getFormSchema($modelSetId)
], __('message.fetched'));
}
/**
* @OA\Post(
* path="/v1/estimates/preview/{model_set_id}",
* summary="견적 계산 미리보기",
* tags={"Estimate"},
* security={{"bearerAuth": {}}},
*
* @OA\Parameter(name="model_set_id", in="path", required=true, description="모델셋 ID", @OA\Schema(type="integer")),
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(
* required={"parameters"},
*
* @OA\Property(property="parameters", type="object", description="견적 파라미터")
* )
* ),
*
* @OA\Response(response=200, description="계산 성공")
* )
*/
public function previewCalculation(Request $request, $modelSetId)
{
$request->validate([