fix : 권한관리 기능 추가 (각 기능 확인 필요)
- 메뉴관리 - 역할관리 - 부서관리 - 메뉴, 부서, 역할, 유저 - 권한 연동
This commit is contained in:
180
app/Swagger/v1/RoleApi.php
Normal file
180
app/Swagger/v1/RoleApi.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace App\Swagger\v1;
|
||||
|
||||
/**
|
||||
* @OA\Tag(name="Role", description="역할 관리(목록/조회/등록/수정/삭제)")
|
||||
*/
|
||||
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="Role",
|
||||
* type="object",
|
||||
* description="역할 상세",
|
||||
* required={"id","name","guard_name"},
|
||||
* @OA\Property(property="id", type="integer", example=3),
|
||||
* @OA\Property(property="tenant_id", type="integer", example=1),
|
||||
* @OA\Property(property="name", type="string", example="menu-manager"),
|
||||
* @OA\Property(property="description", type="string", nullable=true, example="메뉴 관리 역할"),
|
||||
* @OA\Property(property="guard_name", type="string", example="api"),
|
||||
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-08-16 10:00:00"),
|
||||
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-08-16 10:00:00")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="RoleBrief",
|
||||
* type="object",
|
||||
* description="역할 요약",
|
||||
* required={"id","name"},
|
||||
* @OA\Property(property="id", type="integer", example=3),
|
||||
* @OA\Property(property="name", type="string", example="readonly"),
|
||||
* @OA\Property(property="description", type="string", nullable=true, example="읽기 전용"),
|
||||
* @OA\Property(property="guard_name", type="string", example="api")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="RoleList",
|
||||
* type="array",
|
||||
* @OA\Items(ref="#/components/schemas/RoleBrief")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="RoleCreateRequest",
|
||||
* type="object",
|
||||
* required={"name"},
|
||||
* @OA\Property(property="name", type="string", example="menu-manager", description="역할명(테넌트+가드 내 고유)"),
|
||||
* @OA\Property(property="description", type="string", nullable=true, example="메뉴 관리 역할")
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="RoleUpdateRequest",
|
||||
* type="object",
|
||||
* @OA\Property(property="name", type="string", example="menu-admin"),
|
||||
* @OA\Property(property="description", type="string", nullable=true, example="설명 변경")
|
||||
* )
|
||||
*/
|
||||
class RoleApi
|
||||
{
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/roles",
|
||||
* summary="역할 목록 조회",
|
||||
* description="테넌트 범위 내 역할 목록을 페이징으로 반환합니다. (q로 이름/설명 검색)",
|
||||
* tags={"Role"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\Parameter(name="page", in="query", required=false, @OA\Schema(type="integer", example=1)),
|
||||
* @OA\Parameter(name="size", in="query", required=false, @OA\Schema(type="integer", example=10)),
|
||||
* @OA\Parameter(name="q", in="query", required=false, @OA\Schema(type="string", example="read")),
|
||||
* @OA\Response(response=200, description="목록 조회 성공",
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@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=2),
|
||||
* @OA\Property(property="data", ref="#/components/schemas/RoleList")
|
||||
* ))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function index() {}
|
||||
|
||||
/**
|
||||
* @OA\Post(
|
||||
* path="/api/v1/roles",
|
||||
* summary="역할 생성",
|
||||
* description="새로운 역할을 생성합니다.",
|
||||
* tags={"Role"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/RoleCreateRequest")),
|
||||
* @OA\Response(response=200, description="생성 성공",
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Role"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(response=422, 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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function store() {}
|
||||
|
||||
/**
|
||||
* @OA\Get(
|
||||
* path="/api/v1/roles/{id}",
|
||||
* summary="역할 단건 조회",
|
||||
* description="ID로 역할 상세를 조회합니다.",
|
||||
* tags={"Role"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=3)),
|
||||
* @OA\Response(response=200, description="단건 조회 성공",
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Role"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(response=404, 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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function show() {}
|
||||
|
||||
/**
|
||||
* @OA\Patch(
|
||||
* path="/api/v1/roles/{id}",
|
||||
* summary="역할 수정",
|
||||
* description="기존 역할 정보를 부분 수정합니다.",
|
||||
* tags={"Role"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=3)),
|
||||
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/RoleUpdateRequest")),
|
||||
* @OA\Response(response=200, description="수정 성공",
|
||||
* @OA\JsonContent(
|
||||
* allOf={
|
||||
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||||
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Role"))
|
||||
* }
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(response=404, description="데이터 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||||
* @OA\Response(response=422, 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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function update() {}
|
||||
|
||||
/**
|
||||
* @OA\Delete(
|
||||
* path="/api/v1/roles/{id}",
|
||||
* summary="역할 삭제",
|
||||
* description="지정한 역할을 삭제합니다.",
|
||||
* tags={"Role"},
|
||||
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
|
||||
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=3)),
|
||||
* @OA\Response(response=200, description="삭제 성공",
|
||||
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||||
* ),
|
||||
* @OA\Response(response=404, 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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||||
* )
|
||||
*/
|
||||
public function destroy() {}
|
||||
}
|
||||
Reference in New Issue
Block a user