359 lines
13 KiB
PHP
359 lines
13 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="Product", description="제품 카테고리/검색(간단)")
|
|
* @OA\Tag(name="Products", description="제품/부품/서브어셈블리 CRUD")
|
|
* @OA\Tag(name="Products-BOM", description="제품 BOM (제품/자재 혼합) 관리")
|
|
*/
|
|
|
|
|
|
/**
|
|
* 카테고리 목록 조회 (기존)
|
|
* @OA\Get(
|
|
* path="/api/v1/product/category",
|
|
* summary="제품 카테고리 목록 조회",
|
|
* description="제품 카테고리(최상위: parent_id = null) 리스트를 반환합니다.",
|
|
* tags={"Products"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="카테고리 목록 조회 성공",
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="array",
|
|
* @OA\Items(ref="#/components/schemas/ProductCategory")
|
|
* )
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
class ProductApi
|
|
{
|
|
/**
|
|
* 제품 목록/검색
|
|
* @OA\Get(
|
|
* path="/api/v1/products",
|
|
* tags={"Products"},
|
|
* summary="제품 목록/검색",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(ref="#/components/parameters/Page"),
|
|
* @OA\Parameter(ref="#/components/parameters/Size"),
|
|
* @OA\Parameter(name="q", in="query", @OA\Schema(type="string"), description="코드/이름/설명 검색"),
|
|
* @OA\Parameter(name="category_id", in="query", @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="product_type", in="query", @OA\Schema(type="string", example="PRODUCT")),
|
|
* @OA\Parameter(name="active", in="query", @OA\Schema(type="integer", enum={0,1})),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ProductPagination"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function productsIndex() {}
|
|
|
|
|
|
/**
|
|
* 제품 생성
|
|
* @OA\Post(
|
|
* path="/api/v1/products",
|
|
* tags={"Products"},
|
|
* summary="제품 생성",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ProductCreateRequest")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="생성 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Product"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function productsStore() {}
|
|
|
|
|
|
/**
|
|
* 제품 단건
|
|
* @OA\Get(
|
|
* path="/api/v1/products/{id}",
|
|
* tags={"Products"},
|
|
* summary="제품 단건 조회",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Product"))
|
|
* })
|
|
* ),
|
|
* @OA\Response(response=404, description="없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function productsShow() {}
|
|
|
|
/**
|
|
* 제품 수정
|
|
* @OA\Patch(
|
|
* path="/api/v1/products/{id}",
|
|
* tags={"Products"},
|
|
* summary="제품 수정",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ProductUpdateRequest")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="수정 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Product"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function productsUpdate() {}
|
|
|
|
/**
|
|
* 제품 삭제(soft)
|
|
* @OA\Delete(
|
|
* path="/api/v1/products/{id}",
|
|
* tags={"Products"},
|
|
* summary="제품 삭제(soft)",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(response=200, description="삭제 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse"))
|
|
* )
|
|
*/
|
|
public function productsDestroy() {}
|
|
|
|
/**
|
|
* 제품 간편 검색(모달/드롭다운)
|
|
* @OA\Get(
|
|
* path="/api/v1/products/search",
|
|
* tags={"Products"},
|
|
* summary="제품 간편 검색",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="q", in="query", @OA\Schema(type="string")),
|
|
* @OA\Parameter(name="limit", in="query", @OA\Schema(type="integer"), description="기본 20"),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="검색 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="array",
|
|
* @OA\Items(type="object",
|
|
* @OA\Property(property="id", type="integer", example=101),
|
|
* @OA\Property(property="code", type="string", example="PRD-001"),
|
|
* @OA\Property(property="name", type="string", example="스크린 모듈 KS001"),
|
|
* @OA\Property(property="product_type", type="string", example="PRODUCT"),
|
|
* @OA\Property(property="category_id", type="integer", example=7),
|
|
* @OA\Property(property="is_active", type="integer", example=1)
|
|
* )
|
|
* )
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function productsSearch() {}
|
|
|
|
/**
|
|
* 제품 활성/비활성 토글
|
|
* @OA\Post(
|
|
* path="/api/v1/products/{id}/toggle",
|
|
* tags={"Products"},
|
|
* summary="제품 활성/비활성 토글",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="토글 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(property="data", type="object",
|
|
* @OA\Property(property="id", type="integer", example=101),
|
|
* @OA\Property(property="is_active", type="integer", example=0)
|
|
* )
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function productsToggle() {}
|
|
|
|
/**
|
|
* BOM 항목 목록
|
|
* @OA\Get(
|
|
* path="/api/v1/products/{id}/bom/items",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 항목 목록(제품+자재 병합)",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/BomItem"))
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function bomItemsIndex() {}
|
|
|
|
/**
|
|
* BOM 대량 업서트
|
|
* @OA\Post(
|
|
* path="/api/v1/products/{id}/bom/items/bulk",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 항목 대량 업서트",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/BomItemBulkUpsertRequest")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="업서트 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(property="data", type="object",
|
|
* @OA\Property(property="created", type="integer", example=2),
|
|
* @OA\Property(property="updated", type="integer", example=3)
|
|
* )
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function bomItemsBulk() {}
|
|
|
|
/**
|
|
* BOM 단건 수정
|
|
* @OA\Patch(
|
|
* path="/api/v1/products/{id}/bom/items/{item}",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 항목 단건 수정",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="item", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/BomItemUpdateRequest")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="수정 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/BomItem"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function bomItemsUpdate() {}
|
|
|
|
/**
|
|
* BOM 단건 삭제
|
|
* @OA\Delete(
|
|
* path="/api/v1/products/{id}/bom/items/{item}",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 항목 단건 삭제",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="item", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(response=200, description="삭제 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse"))
|
|
* )
|
|
*/
|
|
public function bomItemsDestroy() {}
|
|
|
|
/**
|
|
* BOM 정렬 변경
|
|
* @OA\Post(
|
|
* path="/api/v1/products/{id}/bom/items/reorder",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 정렬 변경",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/BomReorderRequest")),
|
|
* @OA\Response(response=200, description="저장 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse"))
|
|
* )
|
|
*/
|
|
public function bomItemsReorder() {}
|
|
|
|
/**
|
|
* BOM 요약(건수/합계 등)
|
|
* @OA\Get(
|
|
* path="/api/v1/products/{id}/bom/summary",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 요약",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="요약 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(property="data", type="object",
|
|
* @OA\Property(property="count", type="integer", example=5),
|
|
* @OA\Property(property="count_product", type="integer", example=2),
|
|
* @OA\Property(property="count_material", type="integer", example=3),
|
|
* @OA\Property(property="quantity_sum", type="string", example="7.0000")
|
|
* )
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function bomSummary() {}
|
|
|
|
/**
|
|
* BOM 유효성 검사
|
|
* @OA\Get(
|
|
* path="/api/v1/products/{id}/bom/validate",
|
|
* tags={"Products-BOM"},
|
|
* summary="BOM 유효성 검사",
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="검증 결과",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
* @OA\Property(property="data", type="object",
|
|
* @OA\Property(property="valid", type="boolean", example=false),
|
|
* @OA\Property(property="errors", type="array",
|
|
* @OA\Items(type="object",
|
|
* @OA\Property(property="id", type="integer", example=11),
|
|
* @OA\Property(property="error", type="string", example="DUPLICATE_ITEM")
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function bomValidate() {}
|
|
}
|