Files
sam-api/app/Swagger/v1/TenantApi.php

325 lines
15 KiB
PHP
Raw Normal View History

<?php
namespace App\Swagger\v1;
/**
* @OA\Tag(name="Auth", description="로그인/로그아웃")
* @OA\Tag(name="User", description="사용자 본인 정보/비밀번호 변경 등")
* @OA\Tag(name="Tenant", description="테넌트 정보 조회/수정/등록/삭제")
*/
/**
* @OA\Schema(
* schema="Tenant",
* type="object",
* description="테넌트 상세 정보",
* required={"id","company_name"},
*
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="company_name", type="string", example="(주)경동기업"),
* @OA\Property(property="code", type="string", example="KDCOM"),
* @OA\Property(property="email", type="string", example="kd5130@naver.com"),
* @OA\Property(property="phone", type="string", example="01083935130"),
* @OA\Property(property="address", type="string", example="경기도 김포시 통진읍 옹정로 45-22"),
* @OA\Property(property="business_num", type="string", example="1398700333"),
* @OA\Property(property="corp_reg_no", type="string", nullable=true, example=null),
* @OA\Property(property="ceo_name", type="string", example="이대표"),
* @OA\Property(property="homepage", type="string", nullable=true, example=null),
* @OA\Property(property="fax", type="string", nullable=true, example=null),
* @OA\Property(property="logo", type="string", nullable=true, example=null),
* @OA\Property(property="admin_memo", type="string", nullable=true, example=null),
* @OA\Property(property="options", type="string", nullable=true, example=null),
* @OA\Property(property="created_at", type="string", format="date-time", example="2025-07-16 18:28:41"),
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-25 23:13:06"),
* @OA\Property(property="deleted_at", type="string", format="date-time", nullable=true, example=null)
* )
*
* @OA\Schema(
* schema="TenantPagination",
* type="object",
* description="라라벨 LengthAwarePaginator 기본 구조",
*
* @OA\Property(property="current_page", type="integer", example=1),
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(ref="#/components/schemas/TenantBrief")
* ),
*
* @OA\Property(property="first_page_url", type="string", example="/api/v1/tenants/list?page=1"),
* @OA\Property(property="from", type="integer", example=1),
* @OA\Property(property="last_page", type="integer", example=1),
* @OA\Property(property="last_page_url", type="string", example="/api/v1/tenants/list?page=1"),
* @OA\Property(
* property="links",
* type="array",
*
* @OA\Items(
* type="object",
*
* @OA\Property(property="url", type="string", nullable=true, example=null),
* @OA\Property(property="label", type="string", example="&laquo; Previous"),
* @OA\Property(property="active", type="boolean", example=false)
* )
* ),
* @OA\Property(property="next_page_url", type="string", nullable=true, example=null),
* @OA\Property(property="path", type="string", example="/api/v1/tenants/list"),
* @OA\Property(property="per_page", type="integer", example=20),
* @OA\Property(property="prev_page_url", type="string", nullable=true, example=null),
* @OA\Property(property="to", type="integer", example=3),
* @OA\Property(property="total", type="integer", example=3)
* )
*
* @OA\Schema(
* schema="TenantCreateRequest",
* type="object",
* required={"company_name"},
*
* @OA\Property(property="company_name", type="string", example="(주)신규기업", description="회사명"),
* @OA\Property(property="email", type="string", nullable=true, example="newcompany@example.com", description="대표 이메일"),
* @OA\Property(property="phone", type="string", nullable=true, example="01012345678", description="대표 연락처"),
* @OA\Property(property="address", type="string", nullable=true, example="서울시 강남구", description="주소"),
* @OA\Property(property="business_num", type="string", nullable=true, example="1234567890", description="사업자등록번호"),
* @OA\Property(property="ceo_name", type="string", nullable=true, example="김대표", description="대표자명")
* )
*
* @OA\Schema(
* schema="TenantUpdateRequest",
* type="object",
*
* @OA\Property(property="tenant_id", type="integer", example=1, description="수정 대상 테넌트 ID"),
* @OA\Property(property="company_name", type="string", example="(주)신규기업", description="회사명"),
* @OA\Property(property="email", type="string", example="newcompany@example.com", description="대표 이메일"),
* @OA\Property(property="phone", type="string", example="01012345678", description="대표 연락처"),
* @OA\Property(property="address", type="string", nullable=true, example="서울시 강남구", description="주소"),
* @OA\Property(property="business_num", type="string", nullable=true, example="1234567890", description="사업자등록번호"),
* @OA\Property(property="ceo_name", type="string", nullable=true, example="김대표", description="대표자명")
* )
*/
class TenantApi
{
/**
* @OA\Get(
* path="/api/v1/tenants/list",
* summary="테넌트 목록 조회",
* description="등록된 모든 테넌트 목록을 페이징 형태로 반환합니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(ref="#/components/parameters/Page"),
* @OA\Parameter(ref="#/components/parameters/Size"),
*
* @OA\Response(
* response=200,
* description="테넌트 목록 조회 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/TenantPagination"))
* }
* )
* ),
*
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function index() {}
/**
* @OA\Get(
* path="/api/v1/tenants",
* summary="테넌트 정보 조회",
* description="활성(현재) 테넌트의 상세 정보를 조회합니다. 필요 시 쿼리로 특정 테넌트를 확장할 수 있습니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(
* name="tenant_id",
* in="query",
* required=false,
* description="조회할 테넌트 ID (없으면 활성 테넌트)",
*
* @OA\Schema(type="integer", example=1)
* ),
*
* @OA\Response(
* response=200,
* description="테넌트 정보 조회 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Tenant"))
* }
* )
* ),
*
* @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\Post(
* path="/api/v1/tenants",
* summary="테넌트 등록",
* description="새로운 테넌트를 등록합니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/TenantCreateRequest")),
*
* @OA\Response(
* response=200,
* description="등록 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(property="message", type="string", example="등록 성공"),
* @OA\Property(property="data", ref="#/components/schemas/TenantBrief")
* )
* }
* )
* ),
*
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function store() {}
/**
* @OA\Put(
* path="/api/v1/tenants",
* summary="테넌트 정보 수정",
* description="기존 테넌트 정보를 수정합니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/TenantUpdateRequest")),
*
* @OA\Response(
* response=200,
* description="수정 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(property="message", type="string", example="수정 성공"),
* @OA\Property(property="data", ref="#/components/schemas/TenantBrief")
* )
* }
* )
* ),
*
* @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="데이터 없음", @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\Delete(
* path="/api/v1/tenants",
* summary="테넌트 삭제(탈퇴)",
* description="테넌트를 삭제(또는 탈퇴 처리)합니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Response(
* response=200,
* description="삭제 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @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="데이터 없음", @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\Put(
* path="/api/v1/tenants/restore/{tenant_id}",
* summary="테넌트 복구",
* description="삭제(소프트 삭제)된 테넌트를 복구합니다.",
* tags={"Tenant"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
*
* @OA\Parameter(
* name="tenant_id",
* in="path",
* required=true,
* description="복구할 테넌트 ID",
*
* @OA\Schema(type="integer", example=1)
* ),
*
* @OA\Response(
* response=200,
* description="복구 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @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="데이터 없음", @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() {}
}