feat: Swagger 문서 업데이트 및 API 그룹화 최적화
- Settings 그룹 API 문서 추가 * CommonController에 공통 코드 관리 CRUD 문서 작성 * TenantFieldSettingController에 필드 설정 관리 문서 작성 * "Settings - Common Codes", "Settings - Fields" 태그로 그룹화 - Products/Materials 통합 문서 업데이트 * MaterialController에 "Products & Materials - Materials" 태그 적용 * Products 그룹 내 자재 관리로 통합 구성 - Files API 완전한 Swagger 문서 추가 * FileController에 누락되었던 전체 API 문서 작성 * 파일 업로드/조회/삭제/정보조회 모든 엔드포인트 문서화 * "Files" 태그로 독립적인 그룹 구성 - 새로운 에러 메시지 응답 예제 추가 * Materials 관련: 중복 코드, 사용 중 삭제 불가, 정보 없음 * Settings 관련: 중복 공통 코드, 필드 설정 없음, 유효하지 않은 타입 * Files 관련: 업로드 실패, 파일 크기 초과, 지원하지 않는 형식 - 제거된 BOM 라우트 문서 정리 * 사용하지 않는 BomApi.php 파일 삭제 * 기본 BOM 시스템(/v1/boms) 완전 제거로 문서 정합성 확보 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,9 +7,85 @@
|
||||
use App\Services\FileService;
|
||||
use App\Helpers\ApiResponse;
|
||||
|
||||
/**
|
||||
* @OA\Tag(
|
||||
* name="Files",
|
||||
* description="파일 관리 API"
|
||||
* )
|
||||
*/
|
||||
class FileController extends Controller
|
||||
{
|
||||
// 파일 업로드
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/file/upload",
|
||||
* summary="파일 업로드",
|
||||
* description="파일을 업로드합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
* @OA\MediaType(
|
||||
* mediaType="multipart/form-data",
|
||||
* @OA\Schema(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="files[]",
|
||||
* type="array",
|
||||
* @OA\Items(type="string", format="binary"),
|
||||
* description="업로드할 파일들"
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=201,
|
||||
* description="파일 업로드 성공",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 업로드"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||
* @OA\Property(property="size", type="integer", example=1024)
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=400,
|
||||
* description="파일 업로드 실패",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일 업로드에 실패했습니다.")
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=413,
|
||||
* description="파일 크기 초과",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일 크기가 너무 큽니다.")
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=415,
|
||||
* description="지원하지 않는 파일 형식",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="허용되지 않는 파일 형식입니다.")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function upload(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
@@ -17,7 +93,55 @@ public function upload(Request $request)
|
||||
}, '파일 업로드');
|
||||
}
|
||||
|
||||
// 파일 목록 조회
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/file/list",
|
||||
* summary="파일 목록 조회",
|
||||
* description="파일 목록을 조회합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
* @OA\Parameter(
|
||||
* name="page",
|
||||
* in="query",
|
||||
* description="페이지 번호",
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* name="size",
|
||||
* in="query",
|
||||
* description="페이지 크기",
|
||||
* @OA\Schema(type="integer", example=10)
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 목록 조회 성공",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 목록조회"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="object",
|
||||
* @OA\Property(property="current_page", type="integer", example=1),
|
||||
* @OA\Property(property="per_page", type="integer", example=10),
|
||||
* @OA\Property(property="total", type="integer", example=25),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||
* @OA\Property(property="size", type="integer", example=1024),
|
||||
* @OA\Property(property="uploaded_at", type="string", format="date-time")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function list(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
@@ -25,7 +149,45 @@ public function list(Request $request)
|
||||
}, '파일 목록조회');
|
||||
}
|
||||
|
||||
// 파일 삭제
|
||||
/**
|
||||
* @OA\Delete(
|
||||
* path="/api/v1/file/delete",
|
||||
* summary="파일 삭제",
|
||||
* description="파일을 삭제합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
* @OA\RequestBody(
|
||||
* required=true,
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="file_ids",
|
||||
* type="array",
|
||||
* @OA\Items(type="integer"),
|
||||
* example={1, 2, 3}
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 삭제 성공",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 삭제")
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="파일을 찾을 수 없음",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function delete(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
@@ -33,7 +195,50 @@ public function delete(Request $request)
|
||||
}, '파일 삭제');
|
||||
}
|
||||
|
||||
// 파일 정보 조회 (단건)
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/file/find",
|
||||
* summary="파일 정보 조회",
|
||||
* description="특정 파일의 정보를 조회합니다.",
|
||||
* tags={"Files"},
|
||||
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
||||
* @OA\Parameter(
|
||||
* name="file_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="파일 ID",
|
||||
* @OA\Schema(type="integer", example=1)
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="파일 정보 조회 성공",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=true),
|
||||
* @OA\Property(property="message", type="string", example="파일 정보 조회"),
|
||||
* @OA\Property(
|
||||
* property="data",
|
||||
* type="object",
|
||||
* @OA\Property(property="id", type="integer", example=1),
|
||||
* @OA\Property(property="filename", type="string", example="document.pdf"),
|
||||
* @OA\Property(property="path", type="string", example="/uploads/tenant/1/document.pdf"),
|
||||
* @OA\Property(property="size", type="integer", example=1024),
|
||||
* @OA\Property(property="mime_type", type="string", example="application/pdf"),
|
||||
* @OA\Property(property="uploaded_at", type="string", format="date-time")
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=404,
|
||||
* description="파일을 찾을 수 없음",
|
||||
* @OA\JsonContent(
|
||||
* type="object",
|
||||
* @OA\Property(property="success", type="boolean", example=false),
|
||||
* @OA\Property(property="message", type="string", example="파일을 찾을 수 없습니다.")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
public function findFile(Request $request)
|
||||
{
|
||||
return ApiResponse::handle(function () use ($request) {
|
||||
|
||||
Reference in New Issue
Block a user