- ClientGroupService 구현: 고객 그룹 관리 비즈니스 로직 (CRUD + toggle) - ClientGroupController 구현: 6개 REST API 엔드포인트 - PricingController 구현: 5개 가격 관리 API 엔드포인트 - routes/api.php에 client-groups, pricing 라우트 등록 - ClientGroupApi.php Swagger 문서 작성 (OpenAPI 3.0) - PricingApi.php Swagger 문서 작성 (OpenAPI 3.0) - l5-swagger 재생성 완료 추가된 파일: - app/Services/ClientGroupService.php - app/Http/Controllers/Api/V1/ClientGroupController.php - app/Http/Controllers/Api/V1/PricingController.php - app/Swagger/v1/ClientGroupApi.php - app/Swagger/v1/PricingApi.php 수정된 파일: - routes/api.php (라우트 11개 추가) - CURRENT_WORKS.md (작업 내용 문서화) API 엔드포인트: - GET/POST/PUT/DELETE /api/v1/client-groups - GET/POST /api/v1/pricing (show, bulk, upsert 포함)
176 lines
7.6 KiB
PHP
176 lines
7.6 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="ClientGroup", description="고객 그룹 관리")
|
|
*
|
|
* @OA\Schema(
|
|
* schema="ClientGroup",
|
|
* type="object",
|
|
* required={"id","group_code","group_name","price_rate"},
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="tenant_id", type="integer", example=1),
|
|
* @OA\Property(property="group_code", type="string", example="VIP"),
|
|
* @OA\Property(property="group_name", type="string", example="VIP 고객"),
|
|
* @OA\Property(property="price_rate", type="number", format="decimal", example=0.9, description="가격 배율 (1.0=기준가, 0.9=90%, 1.1=110%)"),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="created_at", type="string", example="2025-10-01 12:00:00"),
|
|
* @OA\Property(property="updated_at", type="string", example="2025-10-01 12:00:00")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="ClientGroupPagination",
|
|
* type="object",
|
|
* @OA\Property(property="current_page", type="integer", example=1),
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="array",
|
|
* @OA\Items(ref="#/components/schemas/ClientGroup")
|
|
* ),
|
|
* @OA\Property(property="first_page_url", type="string", example="/api/v1/client-groups?page=1"),
|
|
* @OA\Property(property="from", type="integer", example=1),
|
|
* @OA\Property(property="last_page", type="integer", example=3),
|
|
* @OA\Property(property="last_page_url", type="string", example="/api/v1/client-groups?page=3"),
|
|
* @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="« Previous"),
|
|
* @OA\Property(property="active", type="boolean", example=false)
|
|
* )
|
|
* ),
|
|
* @OA\Property(property="next_page_url", type="string", nullable=true, example="/api/v1/client-groups?page=2"),
|
|
* @OA\Property(property="path", type="string", example="/api/v1/client-groups"),
|
|
* @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=20),
|
|
* @OA\Property(property="total", type="integer", example=50)
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="ClientGroupCreateRequest",
|
|
* type="object",
|
|
* required={"group_code","group_name","price_rate"},
|
|
* @OA\Property(property="group_code", type="string", maxLength=30, example="VIP", description="그룹 코드"),
|
|
* @OA\Property(property="group_name", type="string", maxLength=100, example="VIP 고객", description="그룹명"),
|
|
* @OA\Property(property="price_rate", type="number", format="decimal", example=0.9, description="가격 배율 (1.0=기준가)"),
|
|
* @OA\Property(property="is_active", type="boolean", example=true, description="활성 여부")
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="ClientGroupUpdateRequest",
|
|
* type="object",
|
|
* @OA\Property(property="group_code", type="string", maxLength=30),
|
|
* @OA\Property(property="group_name", type="string", maxLength=100),
|
|
* @OA\Property(property="price_rate", type="number", format="decimal"),
|
|
* @OA\Property(property="is_active", type="boolean")
|
|
* )
|
|
*/
|
|
class ClientGroupApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/client-groups",
|
|
* tags={"ClientGroup"},
|
|
* summary="고객 그룹 목록",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer", example=1)),
|
|
* @OA\Parameter(name="size", in="query", @OA\Schema(type="integer", example=20)),
|
|
* @OA\Parameter(name="q", in="query", description="그룹 코드/이름 검색", @OA\Schema(type="string")),
|
|
* @OA\Parameter(name="only_active", in="query", @OA\Schema(type="boolean")),
|
|
* @OA\Response(response=200, description="조회 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ClientGroupPagination"))
|
|
* })
|
|
* ),
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function index() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/client-groups/{id}",
|
|
* tags={"ClientGroup"},
|
|
* summary="고객 그룹 단건 조회",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @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/ClientGroup"))
|
|
* })
|
|
* ),
|
|
* @OA\Response(response=404, description="데이터 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function show() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/client-groups",
|
|
* tags={"ClientGroup"},
|
|
* summary="고객 그룹 생성",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ClientGroupCreateRequest")),
|
|
* @OA\Response(response=200, description="생성 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ClientGroup"))
|
|
* })
|
|
* ),
|
|
* @OA\Response(response=400, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
* )
|
|
*/
|
|
public function store() {}
|
|
|
|
/**
|
|
* @OA\Put(
|
|
* path="/api/v1/client-groups/{id}",
|
|
* tags={"ClientGroup"},
|
|
* summary="고객 그룹 수정",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ClientGroupUpdateRequest")),
|
|
* @OA\Response(response=200, description="수정 성공",
|
|
* @OA\JsonContent(allOf={
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ClientGroup"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function update() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/client-groups/{id}",
|
|
* tags={"ClientGroup"},
|
|
* summary="고객 그룹 삭제(soft)",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Response(response=200, description="삭제 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse"))
|
|
* )
|
|
*/
|
|
public function destroy() {}
|
|
|
|
/**
|
|
* @OA\Patch(
|
|
* path="/api/v1/client-groups/{id}/toggle",
|
|
* tags={"ClientGroup"},
|
|
* summary="활성/비활성 토글",
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
* @OA\Parameter(name="id", in="path", required=true, @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/ClientGroup"))
|
|
* })
|
|
* )
|
|
* )
|
|
*/
|
|
public function toggle() {}
|
|
} |