- 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>
156 lines
5.9 KiB
PHP
156 lines
5.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\TenantFieldSettingService;
|
|
use App\Helpers\ApiResponse;
|
|
|
|
/**
|
|
* @OA\Tag(
|
|
* name="Settings - Fields",
|
|
* description="테넌트 필드 설정 관리 API"
|
|
* )
|
|
*/
|
|
class TenantFieldSettingController extends Controller
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/settings/fields",
|
|
* summary="테넌트 필드 설정 목록 조회",
|
|
* description="전역 + 테넌트별 병합된 필드 설정 효과값을 조회합니다.",
|
|
* tags={"Settings - Fields"},
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
* @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="array",
|
|
* @OA\Items(
|
|
* type="object",
|
|
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
|
* @OA\Property(property="field_value", type="string", example="true"),
|
|
* @OA\Property(property="source", type="string", example="tenant", description="global 또는 tenant")
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
return ApiResponse::handle(function () use ($request) {
|
|
return TenantFieldSettingService::index($request->all());
|
|
}, '테넌트 필드 효과값 목록 조회');
|
|
}
|
|
|
|
/**
|
|
* @OA\Put(
|
|
* path="/api/v1/settings/fields/bulk",
|
|
* summary="테넌트 필드 설정 대량 저장",
|
|
* description="여러 필드 설정을 트랜잭션으로 일괄 저장합니다.",
|
|
* tags={"Settings - Fields"},
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(
|
|
* property="fields",
|
|
* type="array",
|
|
* @OA\Items(
|
|
* type="object",
|
|
* @OA\Property(property="field_key", type="string", example="product_name_required"),
|
|
* @OA\Property(property="field_value", type="string", example="true")
|
|
* )
|
|
* )
|
|
* )
|
|
* ),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="대량 저장 성공",
|
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
|
* ),
|
|
* @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=422,
|
|
* description="유효성 검사 실패",
|
|
* @OA\JsonContent(ref="#/components/schemas/ErrorResponse")
|
|
* )
|
|
* )
|
|
*/
|
|
public function bulkUpsert(Request $request)
|
|
{
|
|
return ApiResponse::handle(function () use ($request) {
|
|
return TenantFieldSettingService::bulkUpsert($request->all());
|
|
}, '테넌트 필드 설정 대량 저장');
|
|
}
|
|
|
|
/**
|
|
* @OA\Patch(
|
|
* path="/api/v1/settings/fields/{key}",
|
|
* summary="테넌트 필드 설정 단건 수정",
|
|
* description="특정 필드 설정을 개별적으로 수정합니다.",
|
|
* tags={"Settings - Fields"},
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
* @OA\Parameter(
|
|
* name="key",
|
|
* in="path",
|
|
* required=true,
|
|
* description="필드 키",
|
|
* @OA\Schema(type="string", example="product_name_required")
|
|
* ),
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(property="field_value", type="string", example="false")
|
|
* )
|
|
* ),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="필드 설정 수정 성공",
|
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
|
* ),
|
|
* @OA\Response(
|
|
* response=404,
|
|
* description="필드 설정을 찾을 수 없음",
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(property="success", type="boolean", example=false),
|
|
* @OA\Property(property="message", type="string", example="해당 필드 설정을 찾을 수 없습니다.")
|
|
* )
|
|
* ),
|
|
* @OA\Response(
|
|
* response=400,
|
|
* description="유효하지 않은 필드 타입",
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(property="success", type="boolean", example=false),
|
|
* @OA\Property(property="message", type="string", example="유효하지 않은 필드 타입입니다.")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function updateOne(Request $request, string $key)
|
|
{
|
|
return ApiResponse::handle(function () use ($request, $key) {
|
|
return TenantFieldSettingService::updateOne($key, $request->all());
|
|
}, '테넌트 필드 설정 단건 수정');
|
|
}
|
|
}
|