diff --git a/app/Swagger/v1/OrderApi.php b/app/Swagger/v1/OrderApi.php index 6f6a0de..38d26ff 100644 --- a/app/Swagger/v1/OrderApi.php +++ b/app/Swagger/v1/OrderApi.php @@ -153,6 +153,23 @@ * * @OA\Property(property="status", type="string", enum={"DRAFT", "CONFIRMED", "IN_PROGRESS", "COMPLETED", "CANCELLED"}, example="CONFIRMED") * ) + * + * @OA\Schema( + * schema="OrderBulkDeleteRequest", + * type="object", + * required={"ids"}, + * + * @OA\Property(property="ids", type="array", @OA\Items(type="integer"), example={1, 2, 3}), + * @OA\Property(property="force", type="boolean", description="강제 삭제 여부 (진행중 수주 포함)", example=false) + * ) + * + * @OA\Schema( + * schema="OrderRevertProductionRequest", + * type="object", + * + * @OA\Property(property="force", type="boolean", description="강제 되돌리기 (물리 삭제, 기본값 false)", example=false), + * @OA\Property(property="reason", type="string", description="되돌리기 사유 (운영 모드 시 필수)", example="고객 요청에 의한 생산지시 취소") + * ) */ class OrderApi { @@ -364,4 +381,86 @@ public function destroy() {} * ) */ public function updateStatus() {} + + /** + * @OA\Delete( + * path="/api/v1/orders/bulk", + * tags={"Order"}, + * summary="수주 일괄 삭제", + * description="여러 수주를 일괄 삭제합니다 (Soft Delete). 진행중/완료 수주는 건너뜁니다.", + * security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}}, + * + * @OA\RequestBody( + * required=true, + * + * @OA\JsonContent(ref="#/components/schemas/OrderBulkDeleteRequest") + * ), + * + * @OA\Response( + * response=200, + * description="성공", + * + * @OA\JsonContent( + * + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string"), + * @OA\Property(property="data", type="object", + * @OA\Property(property="deleted_count", type="integer", example=3), + * @OA\Property(property="skipped_count", type="integer", example=1), + * @OA\Property(property="skipped_ids", type="array", @OA\Items(type="integer"), example={5}) + * ) + * ) + * ), + * + * @OA\Response(response=422, description="유효성 검증 실패") + * ) + */ + public function bulkDestroy() {} + + /** + * @OA\Post( + * path="/api/v1/orders/{id}/revert-production", + * tags={"Order"}, + * summary="생산지시 되돌리기", + * description="생산지시를 되돌립니다. 기본 모드(force=false)에서는 작업지시를 취소 처리하며, 강제 모드(force=true)에서는 물리 삭제합니다.", + * security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}}, + * + * @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")), + * + * @OA\RequestBody( + * required=false, + * + * @OA\JsonContent(ref="#/components/schemas/OrderRevertProductionRequest") + * ), + * + * @OA\Response( + * response=200, + * description="성공", + * + * @OA\JsonContent( + * + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string"), + * @OA\Property(property="data", type="object", + * @OA\Property(property="order", ref="#/components/schemas/Order"), + * @OA\Property(property="deleted_counts", type="object", + * @OA\Property(property="work_results", type="integer", example=0), + * @OA\Property(property="work_order_items", type="integer", example=5), + * @OA\Property(property="work_orders", type="integer", example=2) + * ), + * @OA\Property(property="cancelled_counts", type="object", nullable=true, + * @OA\Property(property="work_orders", type="integer", example=2), + * @OA\Property(property="work_order_items", type="integer", example=5) + * ), + * @OA\Property(property="previous_status", type="string", example="IN_PROGRESS") + * ) + * ) + * ), + * + * @OA\Response(response=400, description="되돌리기 불가 상태 (수주확정/수주등록 상태)"), + * @OA\Response(response=404, description="수주를 찾을 수 없음"), + * @OA\Response(response=422, description="운영 모드에서 사유 미입력") + * ) + */ + public function revertProductionOrder() {} } diff --git a/storage/api-docs/api-docs-v1.json b/storage/api-docs/api-docs-v1.json index 1cd2532..a12284d 100755 --- a/storage/api-docs/api-docs-v1.json +++ b/storage/api-docs/api-docs-v1.json @@ -35625,6 +35625,191 @@ ] } }, + "/api/v1/orders/bulk": { + "delete": { + "tags": [ + "Order" + ], + "summary": "수주 일괄 삭제", + "description": "여러 수주를 일괄 삭제합니다 (Soft Delete). 진행중/완료 수주는 건너뜁니다.", + "operationId": "84fb75f391c22af2356913507ddb98d1", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderBulkDeleteRequest" + } + } + } + }, + "responses": { + "200": { + "description": "성공", + "content": { + "application/json": { + "schema": { + "properties": { + "success": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string" + }, + "data": { + "properties": { + "deleted_count": { + "type": "integer", + "example": 3 + }, + "skipped_count": { + "type": "integer", + "example": 1 + }, + "skipped_ids": { + "type": "array", + "items": { + "type": "integer" + }, + "example": [ + 5 + ] + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "유효성 검증 실패" + } + }, + "security": [ + { + "ApiKeyAuth": [] + }, + { + "BearerAuth": [] + } + ] + } + }, + "/api/v1/orders/{id}/revert-production": { + "post": { + "tags": [ + "Order" + ], + "summary": "생산지시 되돌리기", + "description": "생산지시를 되돌립니다. 기본 모드(force=false)에서는 작업지시를 취소 처리하며, 강제 모드(force=true)에서는 물리 삭제합니다.", + "operationId": "73634a58fa6ef750ab26e38747d03f65", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderRevertProductionRequest" + } + } + } + }, + "responses": { + "200": { + "description": "성공", + "content": { + "application/json": { + "schema": { + "properties": { + "success": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string" + }, + "data": { + "properties": { + "order": { + "$ref": "#/components/schemas/Order" + }, + "deleted_counts": { + "properties": { + "work_results": { + "type": "integer", + "example": 0 + }, + "work_order_items": { + "type": "integer", + "example": 5 + }, + "work_orders": { + "type": "integer", + "example": 2 + } + }, + "type": "object" + }, + "cancelled_counts": { + "properties": { + "work_orders": { + "type": "integer", + "example": 2 + }, + "work_order_items": { + "type": "integer", + "example": 5 + } + }, + "type": "object", + "nullable": true + }, + "previous_status": { + "type": "string", + "example": "IN_PROGRESS" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "400": { + "description": "되돌리기 불가 상태 (수주확정/수주등록 상태)" + }, + "404": { + "description": "수주를 찾을 수 없음" + }, + "422": { + "description": "운영 모드에서 사유 미입력" + } + }, + "security": [ + { + "ApiKeyAuth": [] + }, + { + "BearerAuth": [] + } + ] + } + }, "/api/v1/payments": { "get": { "tags": [ @@ -79288,6 +79473,45 @@ }, "type": "object" }, + "OrderBulkDeleteRequest": { + "required": [ + "ids" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "integer" + }, + "example": [ + 1, + 2, + 3 + ] + }, + "force": { + "description": "강제 삭제 여부 (진행중 수주 포함)", + "type": "boolean", + "example": false + } + }, + "type": "object" + }, + "OrderRevertProductionRequest": { + "properties": { + "force": { + "description": "강제 되돌리기 (물리 삭제, 기본값 false)", + "type": "boolean", + "example": false + }, + "reason": { + "description": "되돌리기 사유 (운영 모드 시 필수)", + "type": "string", + "example": "고객 요청에 의한 생산지시 취소" + } + }, + "type": "object" + }, "Payment": { "description": "결제 정보", "properties": {