- enhance_files_table: 이중 파일명 시스템 (display_name/stored_name), 폴더 관리, 문서 연결 지원
- create_folders_table: 동적 폴더 관리 시스템 (tenant별 커스터마이징 가능)
- 5개 stub 마이그레이션 생성 (file_share_links, file_deletion_logs, storage_usage_history, add_storage_columns_to_tenants)
- FolderSeeder stub 생성
- CURRENT_WORKS.md에 Phase 1 진행상황 문서화
fix: 파일 공유 및 삭제 기능 버그 수정
- ShareLinkRequest: PATH 파라미터 {id}를 file_id로 자동 병합
- routes/api.php: 공유 링크 다운로드를 auth.apikey 그룹 밖으로 이동 (인증 불필요)
- FileShareLink: File, Tenant 클래스 import 추가
- File 모델: softDeleteFile()에서 SoftDeletes의 delete() 메서드 사용
- FileStorageService: getTrash(), restoreFile(), permanentDelete()에서 onlyTrashed() 사용
- File 모델: Tenant 네임스페이스 수정 (App\Models\Tenants\Tenant)
refactor: Swagger 문서 정리 - File 태그를 Files로 통합
- FileApi.php의 모든 태그를 Files로 변경
- 구 파일 시스템 라우트 삭제 (prefix 'file')
- 구 FileController.php 삭제
- 신규 파일 저장소 시스템으로 완전 통합
fix: 모든 legacy 파일 컬럼 nullable 일괄 처리
- 5개 legacy 컬럼을 한 번에 nullable로 변경
* original_name, file_name, file_name_old (string)
* fileable_id, fileable_type (polymorphic)
- foreach 루프로 반복 작업 자동화
- 신규/기존 시스템 간 완전한 하위 호환성 확보
fix: legacy 파일 컬럼 nullable 처리 완료
- file_name, file_name_old 컬럼도 nullable로 변경
- 기존 시스템과 신규 시스템 간 완전한 하위 호환성 확보
- Legacy: original_name, file_name, file_name_old (nullable)
- New: display_name, stored_name (required)
fix: original_name 컬럼 nullable 처리
- original_name을 nullable로 변경하여 하위 호환성 유지
- 새 시스템에서는 display_name 사용, 기존 시스템은 original_name 사용 가능
fix: 파일 업로드 DB 컬럼 누락 및 메시지 구조 개선
- files 테이블에 감사 컬럼 추가 (created_by, updated_by, uploaded_by)
- ApiResponse::handle() 메시지 로직 개선 (접미사 제거)
- 다국어 지원을 위한 완성된 문장 구조 유지
- FileUploadRequest 파일 검증 규칙 수정
fix: 파일 저장소 버그 수정 및 신규 테넌트 폴더 자동 생성
- FolderSeeder 네임스페이스 수정 (App\Models\Tenant → App\Models\Tenants\Tenant)
- FileStorageController use 문 구문 오류 수정 (/ → \)
- TenantObserver에 신규 테넌트 기본 폴더 자동 생성 로직 추가
- 5개 기본 폴더 (생산관리, 품질관리, 회계, 인사, 일반)
- 에러 처리 및 로깅
- 회원가입 시 자동 실행
325 lines
11 KiB
PHP
325 lines
11 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
use OpenApi\Annotations as OA;
|
|
|
|
/**
|
|
* @OA\Tag(name="Folder", description="폴더 관리")
|
|
*
|
|
* ========= 스키마 정의 =========
|
|
*
|
|
* @OA\Schema(
|
|
* schema="Folder",
|
|
* type="object",
|
|
* description="폴더 모델",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="tenant_id", type="integer", example=1),
|
|
* @OA\Property(property="folder_key", type="string", example="product", description="폴더 키 (영문 소문자, 숫자, 하이픈, 언더스코어만 허용)"),
|
|
* @OA\Property(property="folder_name", type="string", example="생산관리", description="폴더 표시명"),
|
|
* @OA\Property(property="description", type="string", nullable=true, example="생산 관련 문서", maxLength=500),
|
|
* @OA\Property(property="display_order", type="integer", example=1, description="정렬 순서"),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="icon", type="string", nullable=true, example="icon-production", maxLength=50),
|
|
* @OA\Property(property="color", type="string", nullable=true, example="#3B82F6", description="색상 코드 (#RRGGBB 형식)"),
|
|
* @OA\Property(property="created_by", type="integer", example=1),
|
|
* @OA\Property(property="updated_by", type="integer", nullable=true, example=1),
|
|
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-01-01T00:00:00Z"),
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-01-01T00:00:00Z")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="FolderStoreRequest",
|
|
* type="object",
|
|
* required={"folder_key", "folder_name"},
|
|
* description="폴더 생성 요청",
|
|
*
|
|
* @OA\Property(property="folder_key", type="string", pattern="^[a-z0-9_-]+$", maxLength=50, example="accounting", description="폴더 키 (영문 소문자, 숫자, 하이픈, 언더스코어만)"),
|
|
* @OA\Property(property="folder_name", type="string", maxLength=100, example="회계", description="폴더 표시명"),
|
|
* @OA\Property(property="description", type="string", nullable=true, maxLength=500, example="회계 관련 문서"),
|
|
* @OA\Property(property="display_order", type="integer", nullable=true, minimum=0, example=10, description="정렬 순서 (미지정 시 자동)"),
|
|
* @OA\Property(property="is_active", type="boolean", nullable=true, example=true),
|
|
* @OA\Property(property="icon", type="string", nullable=true, maxLength=50, example="icon-accounting"),
|
|
* @OA\Property(property="color", type="string", nullable=true, pattern="^#[0-9A-Fa-f]{6}$", example="#10B981")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="FolderUpdateRequest",
|
|
* type="object",
|
|
* description="폴더 수정 요청",
|
|
*
|
|
* @OA\Property(property="folder_key", type="string", pattern="^[a-z0-9_-]+$", maxLength=50, example="accounting"),
|
|
* @OA\Property(property="folder_name", type="string", maxLength=100, example="회계"),
|
|
* @OA\Property(property="description", type="string", nullable=true, maxLength=500, example="회계 관련 문서"),
|
|
* @OA\Property(property="display_order", type="integer", minimum=0, example=5),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="icon", type="string", nullable=true, maxLength=50, example="icon-accounting"),
|
|
* @OA\Property(property="color", type="string", nullable=true, pattern="^#[0-9A-Fa-f]{6}$", example="#10B981")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="FolderReorderRequest",
|
|
* type="object",
|
|
* required={"orders"},
|
|
* description="폴더 순서 변경 요청",
|
|
*
|
|
* @OA\Property(
|
|
* property="orders",
|
|
* type="array",
|
|
* description="폴더 ID와 순서 배열",
|
|
*
|
|
* @OA\Items(
|
|
* type="object",
|
|
* required={"id", "display_order"},
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="display_order", type="integer", example=0)
|
|
* ),
|
|
* example={
|
|
* {"id": 1, "display_order": 0},
|
|
* {"id": 2, "display_order": 1},
|
|
* {"id": 3, "display_order": 2}
|
|
* }
|
|
* )
|
|
* )
|
|
*/
|
|
class FolderApi
|
|
{
|
|
/**
|
|
* 폴더 목록 조회
|
|
*
|
|
* @OA\Get(
|
|
* path="/api/v1/folders",
|
|
* summary="폴더 목록 조회",
|
|
* description="테넌트의 모든 폴더를 display_order 순으로 조회합니다.",
|
|
* tags={"Folder"},
|
|
* 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/Folder"))
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=401, description="인증 실패")
|
|
* )
|
|
*/
|
|
public function index() {}
|
|
|
|
/**
|
|
* 폴더 생성
|
|
*
|
|
* @OA\Post(
|
|
* path="/api/v1/folders",
|
|
* summary="폴더 생성",
|
|
* description="새로운 폴더를 생성합니다.",
|
|
* tags={"Folder"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/FolderStoreRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="폴더 생성 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
*
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
*
|
|
* @OA\Property(property="data", ref="#/components/schemas/Folder")
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=400, description="유효성 검증 실패"),
|
|
* @OA\Response(response=409, description="중복된 folder_key")
|
|
* )
|
|
*/
|
|
public function store() {}
|
|
|
|
/**
|
|
* 폴더 상세 조회
|
|
*
|
|
* @OA\Get(
|
|
* path="/api/v1/folders/{id}",
|
|
* summary="폴더 상세 조회",
|
|
* description="폴더 ID로 상세 정보를 조회합니다.",
|
|
* tags={"Folder"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="id",
|
|
* in="path",
|
|
* required=true,
|
|
* description="폴더 ID",
|
|
*
|
|
* @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/Folder")
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=404, description="폴더를 찾을 수 없음")
|
|
* )
|
|
*/
|
|
public function show() {}
|
|
|
|
/**
|
|
* 폴더 수정
|
|
*
|
|
* @OA\Put(
|
|
* path="/api/v1/folders/{id}",
|
|
* summary="폴더 수정",
|
|
* description="폴더 정보를 수정합니다.",
|
|
* tags={"Folder"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="id",
|
|
* in="path",
|
|
* required=true,
|
|
* description="폴더 ID",
|
|
*
|
|
* @OA\Schema(type="integer")
|
|
* ),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/FolderUpdateRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="폴더 수정 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
*
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(
|
|
*
|
|
* @OA\Property(property="data", ref="#/components/schemas/Folder")
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=400, description="유효성 검증 실패"),
|
|
* @OA\Response(response=404, description="폴더를 찾을 수 없음"),
|
|
* @OA\Response(response=409, description="중복된 folder_key")
|
|
* )
|
|
*/
|
|
public function update() {}
|
|
|
|
/**
|
|
* 폴더 삭제/비활성화
|
|
*
|
|
* @OA\Delete(
|
|
* path="/api/v1/folders/{id}",
|
|
* summary="폴더 삭제",
|
|
* description="폴더를 비활성화합니다. 파일이 있는 폴더는 삭제할 수 없습니다.",
|
|
* tags={"Folder"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(
|
|
* name="id",
|
|
* in="path",
|
|
* required=true,
|
|
* description="폴더 ID",
|
|
*
|
|
* @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/Folder")
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=400, description="폴더에 파일이 있어 삭제 불가"),
|
|
* @OA\Response(response=404, description="폴더를 찾을 수 없음")
|
|
* )
|
|
*/
|
|
public function destroy() {}
|
|
|
|
/**
|
|
* 폴더 순서 변경
|
|
*
|
|
* @OA\Post(
|
|
* path="/api/v1/folders/reorder",
|
|
* summary="폴더 순서 변경",
|
|
* description="여러 폴더의 표시 순서를 일괄 변경합니다.",
|
|
* tags={"Folder"},
|
|
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/FolderReorderRequest")
|
|
* ),
|
|
*
|
|
* @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/Folder"))
|
|
* )
|
|
* }
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(response=400, description="유효성 검증 실패"),
|
|
* @OA\Response(response=404, description="일부 폴더를 찾을 수 없음")
|
|
* )
|
|
*/
|
|
public function reorder() {}
|
|
}
|