Files
sam-api/app/Swagger/v1/CommonComponents.php
hskwon c5ea6d189a feat: Swagger 문서 전면 수정 및 ClientGroup 자동 복원 기능 추가
- CommonComponents.php: ApiResponse/ErrorResponse 글로벌 스키마 수정
  - property="status" → property="success" (boolean)
  - property="data" → property="error" (object with code/details)

- AuthApi, AdminApi, UserApi: 개별 응답 스키마 수정
  - signup(): allOf 구조로 변경
  - index(): Laravel LengthAwarePaginator 구조 적용
  - updateMe(): Member schema 참조로 변경

- PermissionApi, MaterialApi, DepartmentApi: 로컬 스키마 재정의 제거

- ClientGroupService: 삭제된 데이터 자동 복원 기능 구현
  - store(): withTrashed()로 삭제된 데이터 확인 후 restore()
  - update(): 삭제된 코드 존재 시 에러 반환

- ClientApi: client_group_id 필드 추가
  - Client, ClientCreateRequest, ClientUpdateRequest 스키마에 추가

- lang/ko/error.php, lang/en/error.php: 에러 메시지 추가
  - duplicate_code, has_clients, code_exists_in_deleted

- Swagger 문서 재생성 및 검증 완료
2025-10-14 09:10:52 +09:00

111 lines
3.8 KiB
PHP

<?php
namespace App\Swagger\v1;
/**
* 전역 재사용 컴포넌트 정의만 모아둔 파일입니다.
*
* @OA\Parameter(
* parameter="Page",
* name="page",
* in="query",
* required=false,
* description="페이지 번호(1부터)",
* @OA\Schema(type="integer", minimum=1, example=1)
* )
*
* @OA\Parameter(
* parameter="Size",
* name="size",
* in="query",
* required=false,
* description="페이지 당 개수(기본 20)",
* @OA\Schema(type="integer", minimum=1, maximum=200, example=20)
* )
*
* @OA\Schema(
* schema="ApiResponse",
* type="object",
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="요청 성공"),
* @OA\Property(property="data", nullable=true)
* )
*
* @OA\Schema(
* schema="PaginationMeta",
* type="object",
* @OA\Property(property="page", type="integer", example=1),
* @OA\Property(property="size", type="integer", example=20),
* @OA\Property(property="total", type="integer", example=126),
* @OA\Property(property="last_page", type="integer", example=7)
* )
*
* @OA\Schema(
* schema="User",
* type="object",
* required={"id","name","email"},
* @OA\Property(property="id", type="integer", example=101),
* @OA\Property(property="tenant_id", type="integer", example=1),
* @OA\Property(property="name", type="string", example="홍길동"),
* @OA\Property(property="email", type="string", example="hong@kdcorp.co.kr"),
* @OA\Property(property="phone", type="string", nullable=true, example="010-1234-5678"),
* @OA\Property(property="is_active", type="boolean", example=true),
* @OA\Property(property="roles", type="array", @OA\Items(type="string"), example={"admin","manager"}),
* @OA\Property(property="created_at", type="string", example="2025-07-20 10:22:33"),
* @OA\Property(property="updated_at", type="string", example="2025-08-01 15:00:10")
* )
*
* @OA\Schema(
* schema="LoginRequest",
* type="object",
* required={"email","password"},
* @OA\Property(property="email", type="string", example="hong@kdcorp.co.kr"),
* @OA\Property(property="password", type="string", example="secret1234!")
* )
*
* @OA\Schema(
* schema="TokenResponse",
* type="object",
* @OA\Property(property="access_token", type="string", example="eyJhbGciOi..."),
* @OA\Property(property="token_type", type="string", example="Bearer"),
* @OA\Property(property="expires_in", type="integer", example=3600)
* )
*
* @OA\Schema(
* schema="UserUpdateRequest",
* type="object",
* @OA\Property(property="name", type="string", example="홍길동"),
* @OA\Property(property="phone", type="string", example="010-1111-2222")
* )
*
* @OA\Schema(
* schema="PasswordChangeRequest",
* type="object",
* required={"current_password","new_password"},
* @OA\Property(property="current_password", type="string", example="oldPass!234"),
* @OA\Property(property="new_password", type="string", example="NewPass!234")
* )
*
* @OA\Schema(
* schema="SwitchTenantRequest",
* type="object",
* required={"tenant_id"},
* @OA\Property(property="tenant_id", type="integer", example=2, description="스위치할 테넌트 ID")
* )
*
* @OA\Schema(
* schema="ErrorResponse",
* type="object",
* description="공통 에러 응답 포맷",
* @OA\Property(property="success", type="boolean", example=false),
* @OA\Property(property="message", type="string", example="요청 실패"),
* @OA\Property(
* property="error",
* type="object",
* @OA\Property(property="code", type="integer", example=400),
* @OA\Property(property="details", nullable=true, example=null)
* )
* )
*/
class CommonComponents {}