2025-11-11 11:30:17 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
|
|
|
|
|
|
/**
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Tag(name="Items", description="품목 관리 (Product CRUD)")
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="Item",
|
|
|
|
|
* type="object",
|
2025-11-17 11:22:49 +09:00
|
|
|
* required={"id","code","name","product_type","unit"},
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Property(property="id", type="integer", example=1),
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="code", type="string", example="P-001"),
|
|
|
|
|
* @OA\Property(property="name", type="string", example="스크린 제품 A"),
|
|
|
|
|
* @OA\Property(property="product_type", type="string", example="FG", description="FG,PT,SM,RM,CS"),
|
|
|
|
|
* @OA\Property(property="unit", type="string", example="EA"),
|
|
|
|
|
* @OA\Property(property="category_id", type="integer", nullable=true, example=1),
|
|
|
|
|
* @OA\Property(property="description", type="string", nullable=true, example="제품 설명"),
|
|
|
|
|
* @OA\Property(property="is_sellable", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="is_purchasable", type="boolean", example=false),
|
|
|
|
|
* @OA\Property(property="is_producible", type="boolean", example=false),
|
|
|
|
|
* @OA\Property(property="safety_stock", type="integer", nullable=true, example=10),
|
|
|
|
|
* @OA\Property(property="lead_time", type="integer", nullable=true, example=7),
|
|
|
|
|
* @OA\Property(property="is_variable_size", type="boolean", example=false),
|
|
|
|
|
* @OA\Property(property="product_category", type="string", nullable=true, example="SCREEN"),
|
|
|
|
|
* @OA\Property(property="part_type", type="string", nullable=true, example="ASSEMBLY"),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="attributes",
|
|
|
|
|
* type="object",
|
|
|
|
|
* nullable=true,
|
|
|
|
|
* description="동적 속성 (JSON)",
|
|
|
|
|
* example={"color": "black", "weight": 5.5}
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(property="created_at", type="string", example="2025-11-14 10:00:00"),
|
2025-12-01 14:22:50 +09:00
|
|
|
* @OA\Property(property="updated_at", type="string", example="2025-11-14 10:10:00"),
|
|
|
|
|
* @OA\Property(property="deleted_at", type="string", nullable=true, example=null, description="삭제일시 (soft delete)")
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
2025-11-17 11:22:49 +09:00
|
|
|
* schema="ItemCreateRequest",
|
2025-11-11 11:30:17 +09:00
|
|
|
* type="object",
|
2025-11-17 11:22:49 +09:00
|
|
|
* required={"code","name","product_type","unit"},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="code", type="string", maxLength=50, example="P-001"),
|
|
|
|
|
* @OA\Property(property="name", type="string", maxLength=255, example="스크린 제품 A"),
|
|
|
|
|
* @OA\Property(property="product_type", type="string", example="FG", description="FG,PT,SM,RM,CS"),
|
|
|
|
|
* @OA\Property(property="unit", type="string", maxLength=20, example="EA"),
|
|
|
|
|
* @OA\Property(property="category_id", type="integer", nullable=true, example=1),
|
|
|
|
|
* @OA\Property(property="description", type="string", nullable=true, example="제품 설명"),
|
|
|
|
|
* @OA\Property(property="is_sellable", type="boolean", nullable=true, example=true),
|
|
|
|
|
* @OA\Property(property="is_purchasable", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="is_producible", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="safety_stock", type="integer", nullable=true, example=10),
|
|
|
|
|
* @OA\Property(property="lead_time", type="integer", nullable=true, example=7),
|
|
|
|
|
* @OA\Property(property="is_variable_size", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="product_category", type="string", nullable=true, example="SCREEN"),
|
|
|
|
|
* @OA\Property(property="part_type", type="string", nullable=true, example="ASSEMBLY"),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="attributes",
|
|
|
|
|
* type="object",
|
|
|
|
|
* nullable=true,
|
|
|
|
|
* description="동적 속성 (JSON)"
|
|
|
|
|
* )
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
2025-11-17 11:22:49 +09:00
|
|
|
* schema="ItemUpdateRequest",
|
2025-11-11 11:30:17 +09:00
|
|
|
* type="object",
|
|
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="code", type="string", maxLength=50, example="P-001"),
|
|
|
|
|
* @OA\Property(property="name", type="string", maxLength=255, example="스크린 제품 A"),
|
|
|
|
|
* @OA\Property(property="product_type", type="string", example="FG", description="FG,PT,SM,RM,CS"),
|
|
|
|
|
* @OA\Property(property="unit", type="string", maxLength=20, example="EA"),
|
|
|
|
|
* @OA\Property(property="category_id", type="integer", nullable=true, example=1),
|
|
|
|
|
* @OA\Property(property="description", type="string", nullable=true, example="제품 설명"),
|
|
|
|
|
* @OA\Property(property="is_sellable", type="boolean", nullable=true, example=true),
|
|
|
|
|
* @OA\Property(property="is_purchasable", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="is_producible", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="safety_stock", type="integer", nullable=true, example=10),
|
|
|
|
|
* @OA\Property(property="lead_time", type="integer", nullable=true, example=7),
|
|
|
|
|
* @OA\Property(property="is_variable_size", type="boolean", nullable=true, example=false),
|
|
|
|
|
* @OA\Property(property="product_category", type="string", nullable=true, example="SCREEN"),
|
|
|
|
|
* @OA\Property(property="part_type", type="string", nullable=true, example="ASSEMBLY"),
|
2025-11-11 11:30:17 +09:00
|
|
|
* @OA\Property(
|
2025-11-17 11:22:49 +09:00
|
|
|
* property="attributes",
|
|
|
|
|
* type="object",
|
|
|
|
|
* nullable=true,
|
|
|
|
|
* description="동적 속성 (JSON)"
|
|
|
|
|
* )
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
2025-11-30 21:05:44 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="ItemBatchDeleteRequest",
|
|
|
|
|
* type="object",
|
|
|
|
|
* required={"ids"},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="ids",
|
|
|
|
|
* type="array",
|
|
|
|
|
* description="삭제할 품목 ID 목록",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Items(type="integer"),
|
|
|
|
|
* example={1, 2, 3}
|
|
|
|
|
* )
|
|
|
|
|
* )
|
2025-11-11 11:30:17 +09:00
|
|
|
*/
|
|
|
|
|
class ItemsApi
|
|
|
|
|
{
|
2025-11-17 14:30:16 +09:00
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/items",
|
|
|
|
|
* tags={"Items"},
|
|
|
|
|
* summary="품목 목록 조회 (통합)",
|
|
|
|
|
* description="Product + Material 통합 조회, 페이징 지원",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(ref="#/components/parameters/Page"),
|
|
|
|
|
* @OA\Parameter(ref="#/components/parameters/Size"),
|
|
|
|
|
* @OA\Parameter(name="search", in="query", @OA\Schema(type="string"), description="검색어 (code, name)", example="P-001"),
|
2025-12-01 14:22:50 +09:00
|
|
|
* @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), description="품목 타입 필터 (FG,PT,SM,RM,CS 쉼표 구분)", example="FG,PT"),
|
2025-11-17 14:30:16 +09:00
|
|
|
* @OA\Parameter(name="category_id", in="query", @OA\Schema(type="integer"), description="카테고리 ID 필터", example=1),
|
2025-12-01 14:22:50 +09:00
|
|
|
* @OA\Parameter(name="include_deleted", in="query", @OA\Schema(type="boolean"), description="삭제된 항목 포함 여부", example=false),
|
2025-11-17 14:30:16 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목 목록을 조회했습니다."),
|
|
|
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Item")),
|
|
|
|
|
* @OA\Property(property="meta", ref="#/components/schemas/PaginationMeta")
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function index() {}
|
|
|
|
|
|
2025-11-11 11:30:17 +09:00
|
|
|
/**
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Post(
|
2025-11-11 11:30:17 +09:00
|
|
|
* path="/api/v1/items",
|
|
|
|
|
* tags={"Items"},
|
2025-11-17 11:22:49 +09:00
|
|
|
* summary="품목 생성",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\JsonContent(ref="#/components/schemas/ItemCreateRequest")
|
2025-11-11 11:30:17 +09:00
|
|
|
* ),
|
|
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="성공",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목이 등록되었습니다."),
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Item")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function store() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/items/code/{code}",
|
|
|
|
|
* tags={"Items"},
|
|
|
|
|
* summary="품목 코드로 상세 조회",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Parameter(name="code", in="path", required=true, @OA\Schema(type="string"), example="P-001"),
|
|
|
|
|
* @OA\Parameter(name="include_bom", in="query", @OA\Schema(type="boolean"), example=false),
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
2025-11-17 11:22:49 +09:00
|
|
|
* description="성공",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
2025-11-17 11:22:49 +09:00
|
|
|
* type="object",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목을 조회했습니다."),
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Item")
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
2025-11-17 11:22:49 +09:00
|
|
|
* )
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
|
|
|
|
*/
|
2025-11-17 11:22:49 +09:00
|
|
|
public function showByCode() {}
|
2025-11-11 11:30:17 +09:00
|
|
|
|
|
|
|
|
/**
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Put(
|
2025-11-30 21:05:44 +09:00
|
|
|
* path="/api/v1/items/{id}",
|
2025-11-11 11:30:17 +09:00
|
|
|
* tags={"Items"},
|
2025-11-17 11:22:49 +09:00
|
|
|
* summary="품목 수정",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-30 21:05:44 +09:00
|
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer"), example=1, description="품목 ID"),
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\RequestBody(
|
2025-11-11 11:30:17 +09:00
|
|
|
* required=true,
|
|
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\JsonContent(ref="#/components/schemas/ItemUpdateRequest")
|
2025-11-11 11:30:17 +09:00
|
|
|
* ),
|
|
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="성공",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목이 수정되었습니다."),
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Item")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function update() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Delete(
|
2025-11-30 21:05:44 +09:00
|
|
|
* path="/api/v1/items/{id}",
|
2025-11-17 11:22:49 +09:00
|
|
|
* tags={"Items"},
|
|
|
|
|
* summary="품목 삭제",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-30 21:05:44 +09:00
|
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer"), example=1, description="품목 ID"),
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
2025-11-17 11:22:49 +09:00
|
|
|
* description="성공",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
2025-11-17 11:22:49 +09:00
|
|
|
* type="object",
|
2025-11-11 11:30:17 +09:00
|
|
|
*
|
2025-11-17 11:22:49 +09:00
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목이 삭제되었습니다."),
|
|
|
|
|
* @OA\Property(property="data", type="string", example="success")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
2025-11-11 11:30:17 +09:00
|
|
|
* )
|
|
|
|
|
*/
|
2025-11-17 11:22:49 +09:00
|
|
|
public function destroy() {}
|
2025-11-30 21:05:44 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Delete(
|
|
|
|
|
* path="/api/v1/items/batch",
|
|
|
|
|
* tags={"Items"},
|
|
|
|
|
* summary="품목 일괄 삭제",
|
|
|
|
|
* description="여러 품목을 한 번에 삭제합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/ItemBatchDeleteRequest")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="품목이 일괄 삭제되었습니다."),
|
|
|
|
|
* @OA\Property(property="data", type="string", example="success")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function batchDestroy() {}
|
2025-11-17 11:22:49 +09:00
|
|
|
}
|