fix : 카테고리, 제품등록, BOM등록 API (일부 개발 - BOM 추가 작업 필요)
This commit is contained in:
@@ -3,37 +3,19 @@
|
||||
namespace App\Swagger\v1;
|
||||
|
||||
/**
|
||||
* 제품 카테고리 스키마
|
||||
* @OA\Schema(
|
||||
* schema="ProductCategory",
|
||||
* type="object",
|
||||
* description="제품 카테고리",
|
||||
* required={"id","code_group","code","name","is_active","sort_order"},
|
||||
* @OA\Property(property="id", type="integer", example=4),
|
||||
* @OA\Property(property="code_group", type="string", example="category"),
|
||||
* @OA\Property(property="code", type="string", example="BP"),
|
||||
* @OA\Property(property="name", type="string", example="절곡판"),
|
||||
* @OA\Property(property="parent_id", type="integer", nullable=true, example=null),
|
||||
* @OA\Property(
|
||||
* property="attributes",
|
||||
* type="object",
|
||||
* nullable=true,
|
||||
* description="카테고리 속성(자유형식 JSON)",
|
||||
* example={"color":"blue","flags":{"screen":true}}
|
||||
* ),
|
||||
* @OA\Property(property="description", type="string", nullable=true, example="절곡판"),
|
||||
* @OA\Property(property="is_active", type="integer", example=1),
|
||||
* @OA\Property(property="sort_order", type="integer", example=10),
|
||||
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-07-23T09:00:00+09:00"),
|
||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-23T09:00:00+09:00")
|
||||
* )
|
||||
*
|
||||
* 카테고리 목록 조회
|
||||
* @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={"Product"},
|
||||
* tags={"Products"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
@@ -51,12 +33,326 @@
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(response=400, description="필수 파라미터 누락", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
class ProductApi {}
|
||||
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() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user