- DocumentTemplate 모델 6개 생성 (Template, ApprovalLine, BasicField, Section, SectionItem, Column)
- DocumentTemplateService (list/show) + DocumentTemplateController (index/show)
- GET /v1/document-templates, GET /v1/document-templates/{id} 라우트
- DocumentTemplateApi.php Swagger (7개 스키마, 2개 엔드포인트)
- Document 결재 워크플로우 4개 엔드포인트 활성화 (submit/approve/reject/cancel)
- ApproveRequest, RejectRequest FormRequest 생성
- DocumentApi.php Swagger에 결재 엔드포인트 4개 추가
- Document.template() 참조 경로 수정 (DocumentTemplate → Documents 네임스페이스)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
194 lines
11 KiB
PHP
194 lines
11 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="DocumentTemplates", description="문서 양식(템플릿) 관리")
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplate",
|
|
* type="object",
|
|
* description="문서 양식 정보",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1, description="양식 ID"),
|
|
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
|
|
* @OA\Property(property="name", type="string", example="수입검사 성적서 (EGI)", description="양식명"),
|
|
* @OA\Property(property="category", type="string", example="품질", description="분류"),
|
|
* @OA\Property(property="title", type="string", example="수입검사 성적서", nullable=true, description="문서 제목"),
|
|
* @OA\Property(property="company_name", type="string", example="(주)SAM", nullable=true, description="회사명"),
|
|
* @OA\Property(property="company_address", type="string", nullable=true, description="회사 주소"),
|
|
* @OA\Property(property="company_contact", type="string", nullable=true, description="연락처"),
|
|
* @OA\Property(property="footer_remark_label", type="string", example="부적합 내용", description="하단 비고 라벨"),
|
|
* @OA\Property(property="footer_judgement_label", type="string", example="종합판정", description="하단 판정 라벨"),
|
|
* @OA\Property(property="footer_judgement_options", type="array", nullable=true, description="판정 옵션",
|
|
* @OA\Items(type="string", example="적합")
|
|
* ),
|
|
* @OA\Property(property="is_active", type="boolean", example=true, description="활성 여부"),
|
|
* @OA\Property(property="approval_lines", type="array", description="결재라인",
|
|
* @OA\Items(ref="#/components/schemas/DocumentTemplateApprovalLine")
|
|
* ),
|
|
* @OA\Property(property="basic_fields", type="array", description="기본 필드",
|
|
* @OA\Items(ref="#/components/schemas/DocumentTemplateBasicField")
|
|
* ),
|
|
* @OA\Property(property="sections", type="array", description="검사 기준서 섹션",
|
|
* @OA\Items(ref="#/components/schemas/DocumentTemplateSection")
|
|
* ),
|
|
* @OA\Property(property="columns", type="array", description="테이블 컬럼",
|
|
* @OA\Items(ref="#/components/schemas/DocumentTemplateColumn")
|
|
* ),
|
|
* @OA\Property(property="created_at", type="string", format="date-time", example="2026-01-28T09:00:00Z"),
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2026-01-28T09:00:00Z")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplateApprovalLine",
|
|
* type="object",
|
|
* description="양식 결재라인",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="template_id", type="integer", example=1),
|
|
* @OA\Property(property="name", type="string", example="작성", description="결재자 이름/직책"),
|
|
* @OA\Property(property="dept", type="string", example="품질", nullable=true, description="부서"),
|
|
* @OA\Property(property="role", type="string", example="작성", description="역할"),
|
|
* @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplateBasicField",
|
|
* type="object",
|
|
* description="양식 기본 필드",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="template_id", type="integer", example=1),
|
|
* @OA\Property(property="label", type="string", example="품명", description="필드 라벨"),
|
|
* @OA\Property(property="field_type", type="string", example="text", description="필드 타입"),
|
|
* @OA\Property(property="default_value", type="string", example="", nullable=true, description="기본값"),
|
|
* @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplateSection",
|
|
* type="object",
|
|
* description="양식 검사 기준서 섹션",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="template_id", type="integer", example=1),
|
|
* @OA\Property(property="title", type="string", example="검사항목", description="섹션 제목"),
|
|
* @OA\Property(property="image_path", type="string", example="/img/inspection/screen_inspection.jpg", nullable=true, description="검사 기준 이미지"),
|
|
* @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서"),
|
|
* @OA\Property(property="items", type="array", description="검사항목",
|
|
* @OA\Items(ref="#/components/schemas/DocumentTemplateSectionItem")
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplateSectionItem",
|
|
* type="object",
|
|
* description="양식 검사항목",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="section_id", type="integer", example=1),
|
|
* @OA\Property(property="category", type="string", example="외관", nullable=true, description="항목 분류"),
|
|
* @OA\Property(property="item", type="string", example="표면 스크래치", description="검사항목"),
|
|
* @OA\Property(property="standard", type="string", example="스크래치 없을 것", nullable=true, description="검사기준"),
|
|
* @OA\Property(property="method", type="string", example="육안검사", nullable=true, description="검사방식"),
|
|
* @OA\Property(property="frequency", type="string", example="전수", nullable=true, description="검사주기"),
|
|
* @OA\Property(property="regulation", type="string", nullable=true, description="관련 규격"),
|
|
* @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="DocumentTemplateColumn",
|
|
* type="object",
|
|
* description="양식 테이블 컬럼",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="template_id", type="integer", example=1),
|
|
* @OA\Property(property="label", type="string", example="1차", description="컬럼 라벨"),
|
|
* @OA\Property(property="width", type="string", example="80px", nullable=true, description="컬럼 너비"),
|
|
* @OA\Property(property="column_type", type="string", example="check", enum={"text","check","complex","select","measurement"}, description="컬럼 타입"),
|
|
* @OA\Property(property="group_name", type="string", example="측정치", nullable=true, description="그룹명"),
|
|
* @OA\Property(property="sub_labels", type="array", nullable=true, description="하위 라벨 (complex 타입)",
|
|
* @OA\Items(type="string", example="n1")
|
|
* ),
|
|
* @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서")
|
|
* )
|
|
*/
|
|
class DocumentTemplateApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/document-templates",
|
|
* tags={"DocumentTemplates"},
|
|
* summary="양식 목록 조회",
|
|
* description="문서 양식(템플릿) 목록을 조회합니다. 결재라인과 기본필드를 포함합니다.",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
*
|
|
* @OA\Parameter(name="is_active", in="query", description="활성 상태 필터", @OA\Schema(type="boolean")),
|
|
* @OA\Parameter(name="category", in="query", description="카테고리 필터", @OA\Schema(type="string", example="품질")),
|
|
* @OA\Parameter(name="search", in="query", description="검색어 (양식명, 제목)", @OA\Schema(type="string")),
|
|
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"created_at","name","category"}, default="created_at")),
|
|
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="desc")),
|
|
* @OA\Parameter(ref="#/components/parameters/Page"),
|
|
* @OA\Parameter(ref="#/components/parameters/Size"),
|
|
*
|
|
* @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="current_page", type="integer", example=1),
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/DocumentTemplate")),
|
|
* @OA\Property(property="per_page", type="integer", example=20),
|
|
* @OA\Property(property="total", type="integer", example=10)
|
|
* )
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function index() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/document-templates/{id}",
|
|
* tags={"DocumentTemplates"},
|
|
* summary="양식 상세 조회",
|
|
* description="ID 기준 양식 상세 정보를 조회합니다. 결재라인, 기본필드, 섹션(검사항목 포함), 컬럼 전체를 반환합니다.",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, description="양식 ID", @OA\Schema(type="integer", example=7)),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
*
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/DocumentTemplate"))
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="양식을 찾을 수 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function show() {}
|
|
} |