316 lines
14 KiB
PHP
316 lines
14 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Swagger\v1;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Tag(name="Cards", description="카드 관리")
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="Card",
|
||
|
|
* type="object",
|
||
|
|
* description="카드 정보",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="id", type="integer", example=1, description="카드 ID"),
|
||
|
|
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
|
||
|
|
* @OA\Property(property="card_company", type="string", example="삼성카드", description="카드사"),
|
||
|
|
* @OA\Property(property="card_number_last4", type="string", example="1234", description="카드번호 끝 4자리"),
|
||
|
|
* @OA\Property(property="expiry_date", type="string", example="12/25", description="유효기간 (MM/YY)"),
|
||
|
|
* @OA\Property(property="card_name", type="string", example="법인카드 1", description="카드 별칭"),
|
||
|
|
* @OA\Property(property="status", type="string", enum={"active","inactive"}, example="active", description="상태"),
|
||
|
|
* @OA\Property(property="assigned_user_id", type="integer", example=1, nullable=true, description="담당자 ID"),
|
||
|
|
* @OA\Property(property="assigned_user", type="object", nullable=true,
|
||
|
|
* @OA\Property(property="id", type="integer", example=1),
|
||
|
|
* @OA\Property(property="name", type="string", example="홍길동"),
|
||
|
|
* description="담당자 정보"
|
||
|
|
* ),
|
||
|
|
* @OA\Property(property="created_by", type="integer", example=1, nullable=true, description="생성자 ID"),
|
||
|
|
* @OA\Property(property="updated_by", type="integer", example=1, nullable=true, description="수정자 ID"),
|
||
|
|
* @OA\Property(property="created_at", type="string", format="date-time"),
|
||
|
|
* @OA\Property(property="updated_at", type="string", format="date-time")
|
||
|
|
* )
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="CardCreateRequest",
|
||
|
|
* type="object",
|
||
|
|
* required={"card_company","card_number","expiry_date","card_name"},
|
||
|
|
* description="카드 등록 요청",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="card_company", type="string", example="삼성카드", maxLength=50, description="카드사"),
|
||
|
|
* @OA\Property(property="card_number", type="string", example="1234567890123456", description="카드번호 (13-19자리)"),
|
||
|
|
* @OA\Property(property="expiry_date", type="string", example="12/25", pattern="^(0[1-9]|1[0-2])/\\d{2}$", description="유효기간 (MM/YY)"),
|
||
|
|
* @OA\Property(property="card_password", type="string", example="12", maxLength=2, description="비밀번호 앞 2자리 (선택)"),
|
||
|
|
* @OA\Property(property="card_name", type="string", example="법인카드 1", maxLength=100, description="카드 별칭"),
|
||
|
|
* @OA\Property(property="status", type="string", enum={"active","inactive"}, example="active", description="상태"),
|
||
|
|
* @OA\Property(property="assigned_user_id", type="integer", example=1, nullable=true, description="담당자 ID")
|
||
|
|
* )
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="CardUpdateRequest",
|
||
|
|
* type="object",
|
||
|
|
* description="카드 수정 요청",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="card_company", type="string", example="삼성카드", maxLength=50, description="카드사"),
|
||
|
|
* @OA\Property(property="card_number", type="string", example="1234567890123456", description="카드번호 (변경 시)"),
|
||
|
|
* @OA\Property(property="expiry_date", type="string", example="12/25", pattern="^(0[1-9]|1[0-2])/\\d{2}$", description="유효기간 (MM/YY)"),
|
||
|
|
* @OA\Property(property="card_password", type="string", example="12", maxLength=2, description="비밀번호 앞 2자리"),
|
||
|
|
* @OA\Property(property="card_name", type="string", example="법인카드 1", maxLength=100, description="카드 별칭"),
|
||
|
|
* @OA\Property(property="status", type="string", enum={"active","inactive"}, example="active", description="상태"),
|
||
|
|
* @OA\Property(property="assigned_user_id", type="integer", example=1, nullable=true, description="담당자 ID")
|
||
|
|
* )
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="CardListItem",
|
||
|
|
* type="object",
|
||
|
|
* description="카드 목록 아이템 (셀렉트박스용)",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="id", type="integer", example=1, description="카드 ID"),
|
||
|
|
* @OA\Property(property="card_name", type="string", example="법인카드 1", description="카드 별칭"),
|
||
|
|
* @OA\Property(property="card_company", type="string", example="삼성카드", description="카드사"),
|
||
|
|
* @OA\Property(property="display_number", type="string", example="****-1234", description="마스킹된 카드번호")
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
class CardApi
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/v1/cards",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 목록 조회",
|
||
|
|
* description="카드 목록을 조회합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="search", in="query", description="검색어 (카드명, 카드사, 끝4자리)", @OA\Schema(type="string")),
|
||
|
|
* @OA\Parameter(name="status", in="query", description="상태 필터", @OA\Schema(type="string", enum={"active","inactive"})),
|
||
|
|
* @OA\Parameter(name="assigned_user_id", in="query", description="담당자 ID", @OA\Schema(type="integer")),
|
||
|
|
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"card_name","card_company","created_at"}, default="created_at")),
|
||
|
|
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="desc")),
|
||
|
|
* @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",
|
||
|
|
* type="object",
|
||
|
|
* @OA\Property(property="current_page", type="integer", example=1),
|
||
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Card")),
|
||
|
|
* @OA\Property(property="per_page", type="integer", example=20),
|
||
|
|
* @OA\Property(property="total", type="integer", example=10)
|
||
|
|
* )
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(response=401, 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/cards",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 등록",
|
||
|
|
* description="새로운 카드를 등록합니다. 카드번호는 암호화되어 저장됩니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\RequestBody(
|
||
|
|
* required=true,
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(ref="#/components/schemas/CardCreateRequest")
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=201,
|
||
|
|
* description="등록 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Card")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function store() {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/v1/cards/active",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="활성 카드 목록 (셀렉트박스용)",
|
||
|
|
* description="활성 상태의 카드 목록을 간단한 형태로 조회합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="조회 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/CardListItem"))
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function active() {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/v1/cards/{id}",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 상세 조회",
|
||
|
|
* description="카드 상세 정보를 조회합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="id", in="path", required=true, description="카드 ID", @OA\Schema(type="integer")),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="조회 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Card")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=404, 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/cards/{id}",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 수정",
|
||
|
|
* description="카드 정보를 수정합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="id", in="path", required=true, description="카드 ID", @OA\Schema(type="integer")),
|
||
|
|
*
|
||
|
|
* @OA\RequestBody(
|
||
|
|
* required=true,
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(ref="#/components/schemas/CardUpdateRequest")
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="수정 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Card")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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=404, 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/cards/{id}",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 삭제",
|
||
|
|
* description="카드를 삭제합니다. (Soft Delete)",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="id", in="path", required=true, description="카드 ID", @OA\Schema(type="integer")),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="삭제 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=404, description="카드 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function destroy() {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Patch(
|
||
|
|
* path="/api/v1/cards/{id}/toggle",
|
||
|
|
* tags={"Cards"},
|
||
|
|
* summary="카드 상태 토글",
|
||
|
|
* description="카드의 상태를 토글합니다. (active ↔ inactive)",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="id", in="path", required=true, description="카드 ID", @OA\Schema(type="integer")),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="토글 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Card")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=404, description="카드 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
||
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
public function toggle() {}
|
||
|
|
}
|