317 lines
18 KiB
PHP
317 lines
18 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="Admin-Users", description="관리자 전용 사용자 관리")
|
|
*/
|
|
class AdminApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/admin/users",
|
|
* tags={"Admin-Users"},
|
|
* summary="사용자 목록",
|
|
* description="필터/검색/페이지네이션으로 사용자 목록을 조회합니다.",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="q", in="query", description="이름/이메일 검색어", @OA\Schema(type="string")),
|
|
* @OA\Parameter(name="tenant_id", in="query", description="특정 테넌트로 필터", @OA\Schema(type="integer", example=1)),
|
|
* @OA\Parameter(name="role", in="query", description="역할 코드", @OA\Schema(type="string", example="manager")),
|
|
* @OA\Parameter(name="is_active", in="query", description="활성여부", @OA\Schema(type="boolean", example=true)),
|
|
* @OA\Parameter(ref="#/components/parameters/Page"),
|
|
* @OA\Parameter(ref="#/components/parameters/Size"),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(property="status", type="string", example="success"),
|
|
* @OA\Property(property="message", type="string", example="OK"),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="object",
|
|
* @OA\Property(property="items", type="array", @OA\Items(ref="#/components/schemas/User")),
|
|
* @OA\Property(property="meta", ref="#/components/schemas/PaginationMeta")
|
|
* )
|
|
* )
|
|
* ),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function index() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/admin/users",
|
|
* tags={"Admin-Users"},
|
|
* summary="사용자 생성",
|
|
* description="새 사용자를 생성합니다. (초기 비밀번호/역할 포함 가능)",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* required={"name","email","password"},
|
|
* @OA\Property(property="tenant_id", type="integer", example=1),
|
|
* @OA\Property(property="name", type="string", example="김관리"),
|
|
* @OA\Property(property="email", type="string", example="admin@kdcorp.co.kr"),
|
|
* @OA\Property(property="password", type="string", example="Init!2345"),
|
|
* @OA\Property(property="phone", type="string", example="010-3333-4444"),
|
|
* @OA\Property(property="roles", type="array", @OA\Items(type="string"), example={"manager"})
|
|
* )
|
|
* ),
|
|
* @OA\Response(
|
|
* response=201,
|
|
* description="생성됨",
|
|
* @OA\JsonContent(
|
|
* allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/User"))
|
|
* }
|
|
* )
|
|
* ),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=409, description="이메일 중복", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function store() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/admin/users/{id}",
|
|
* tags={"Admin-Users"},
|
|
* summary="사용자 단건 조회",
|
|
* description="ID 기준 사용자 상세",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=101)),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="조회 성공",
|
|
* @OA\JsonContent(
|
|
* allOf={@OA\Schema(ref="#/components/schemas/ApiResponse")},
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/User"))
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function show() {}
|
|
|
|
/**
|
|
* @OA\Put(
|
|
* path="/api/v1/admin/users/{id}",
|
|
* tags={"Admin-Users"},
|
|
* summary="사용자 수정",
|
|
* description="이름/연락처/역할/활성여부 등 변경",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
* @OA\JsonContent(
|
|
* type="object",
|
|
* @OA\Property(property="name", type="string", example="김관리"),
|
|
* @OA\Property(property="phone", type="string", example="010-3333-4444"),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="roles", type="array", @OA\Items(type="string"), example={"manager","staff"})
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=200, description="수정 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse")),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function update() {}
|
|
|
|
/**
|
|
* @OA\Patch(
|
|
* path="/api/v1/admin/users/{id}/status",
|
|
* tags={"Admin-Users"},
|
|
* summary="활성/비활성 전환",
|
|
* description="is_active 토글",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true,
|
|
* @OA\JsonContent(type="object",
|
|
* required={"is_active"},
|
|
* @OA\Property(property="is_active", type="boolean", example=false)
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=204,
|
|
* description="변경 성공(콘텐츠 없음)",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="변경 성공"),
|
|
* @OA\Property(property="data", type="object", nullable=true, example=null)
|
|
* )
|
|
* ),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function toggleStatus() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/admin/users/{id}",
|
|
* tags={"Admin-Users"},
|
|
* summary="사용자 삭제(소프트 삭제)",
|
|
* description="deleted_at / deleted_by 기록",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=204,
|
|
* description="삭제성공",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="변경 성공"),
|
|
* @OA\Property(property="data", type="object", nullable=true, example=null)
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function destroy() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/admin/users/{id}/restore",
|
|
* tags={"Admin-Users"},
|
|
* summary="삭제 복구",
|
|
* description="소프트 삭제 복구",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(
|
|
* response=204,
|
|
* description="삭제 성공",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="변경 성공"),
|
|
* @OA\Property(property="data", type="object", nullable=true, example=null)
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function restore() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/admin/users/{id}/roles",
|
|
* tags={"Admin-Users"},
|
|
* summary="역할 부여",
|
|
* description="사용자에게 역할 추가",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true,
|
|
* @OA\JsonContent(type="object",
|
|
* required={"roles"},
|
|
* @OA\Property(property="roles", type="array", @OA\Items(type="string"), example={"manager"})
|
|
* )
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=204,
|
|
* description="부여 성공",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="변경 성공"),
|
|
* @OA\Property(property="data", type="object", nullable=true, example=null)
|
|
* )
|
|
* ),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=409, description="이메일/역할 중복 등 충돌", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function attachRoles() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/admin/users/{id}/roles/{role}",
|
|
* tags={"Admin-Users"},
|
|
* summary="역할 해제",
|
|
* description="사용자에서 특정 역할 제거",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="role", in="path", required=true, @OA\Schema(type="string", example="manager")),
|
|
* @OA\Response(
|
|
* response=204,
|
|
* description="부여 성공",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string", example="변경 성공"),
|
|
* @OA\Property(property="data", type="object", nullable=true, example=null)
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=409, description="요청 충돌(없는 역할/이미 제거됨 등)", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function detachRole() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/admin/users/{id}/reset-password",
|
|
* tags={"Admin-Users"},
|
|
* summary="비밀번호 초기화",
|
|
* description="임시 비밀번호 발급(또는 링크 전송)",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(
|
|
* required=false,
|
|
* @OA\JsonContent(type="object",
|
|
* @OA\Property(property="temp_password", type="string", example="Temp!1234", description="미지정 시 서버에서 생성")
|
|
* )
|
|
* ),
|
|
* @OA\Response(response=200, description="초기화 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse")),
|
|
* @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=403, description="권한 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=404, description="존재하지 않는 URI 또는 데이터", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=405, description="허용되지 않는 메서드", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=409, description="요청 충돌(정책 위반 등)", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function resetPassword() {}
|
|
}
|