271 lines
12 KiB
PHP
271 lines
12 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Swagger\v1;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @OA\Tag(name="Sites", description="현장 관리")
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="Site",
|
||
|
|
* 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="name", type="string", example="강남 현장", description="현장명"),
|
||
|
|
* @OA\Property(property="address", type="string", example="서울시 강남구 테헤란로 123", nullable=true, description="현장 주소"),
|
||
|
|
* @OA\Property(property="latitude", type="number", format="float", example=37.5012, nullable=true, description="위도"),
|
||
|
|
* @OA\Property(property="longitude", type="number", format="float", example=127.0396, nullable=true, description="경도"),
|
||
|
|
* @OA\Property(property="is_active", type="boolean", example=true, 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="SiteCreateRequest",
|
||
|
|
* type="object",
|
||
|
|
* required={"name"},
|
||
|
|
* description="현장 등록 요청",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="name", type="string", example="강남 현장", maxLength=100, description="현장명"),
|
||
|
|
* @OA\Property(property="address", type="string", example="서울시 강남구 테헤란로 123", maxLength=255, description="현장 주소"),
|
||
|
|
* @OA\Property(property="latitude", type="number", format="float", example=37.5012, minimum=-90, maximum=90, description="위도"),
|
||
|
|
* @OA\Property(property="longitude", type="number", format="float", example=127.0396, minimum=-180, maximum=180, description="경도"),
|
||
|
|
* @OA\Property(property="is_active", type="boolean", example=true, description="활성화 여부")
|
||
|
|
* )
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="SiteUpdateRequest",
|
||
|
|
* type="object",
|
||
|
|
* description="현장 수정 요청",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="name", type="string", example="강남 현장", maxLength=100, description="현장명"),
|
||
|
|
* @OA\Property(property="address", type="string", example="서울시 강남구 테헤란로 123", maxLength=255, description="현장 주소"),
|
||
|
|
* @OA\Property(property="latitude", type="number", format="float", example=37.5012, minimum=-90, maximum=90, description="위도"),
|
||
|
|
* @OA\Property(property="longitude", type="number", format="float", example=127.0396, minimum=-180, maximum=180, description="경도"),
|
||
|
|
* @OA\Property(property="is_active", type="boolean", example=true, description="활성화 여부")
|
||
|
|
* )
|
||
|
|
*
|
||
|
|
* @OA\Schema(
|
||
|
|
* schema="SiteListItem",
|
||
|
|
* type="object",
|
||
|
|
* description="현장 목록 아이템 (셀렉트박스용)",
|
||
|
|
*
|
||
|
|
* @OA\Property(property="id", type="integer", example=1, description="현장 ID"),
|
||
|
|
* @OA\Property(property="name", type="string", example="강남 현장", description="현장명"),
|
||
|
|
* @OA\Property(property="address", type="string", example="서울시 강남구", nullable=true, description="현장 주소")
|
||
|
|
* )
|
||
|
|
*/
|
||
|
|
class SiteApi
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @OA\Get(
|
||
|
|
* path="/api/v1/sites",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* summary="현장 목록 조회",
|
||
|
|
* description="현장 목록을 조회합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\Parameter(name="search", in="query", description="검색어 (현장명, 주소)", @OA\Schema(type="string")),
|
||
|
|
* @OA\Parameter(name="is_active", in="query", description="활성화 상태 필터", @OA\Schema(type="boolean")),
|
||
|
|
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"name","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/Site")),
|
||
|
|
* @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/sites",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* summary="현장 등록",
|
||
|
|
* description="새로운 현장을 등록합니다.",
|
||
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
||
|
|
*
|
||
|
|
* @OA\RequestBody(
|
||
|
|
* required=true,
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(ref="#/components/schemas/SiteCreateRequest")
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=201,
|
||
|
|
* description="등록 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Site")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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/sites/active",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* 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/SiteListItem"))
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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/sites/{id}",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* 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/Site")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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/sites/{id}",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* 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/SiteUpdateRequest")
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @OA\Response(
|
||
|
|
* response=200,
|
||
|
|
* description="수정 성공",
|
||
|
|
*
|
||
|
|
* @OA\JsonContent(
|
||
|
|
* allOf={
|
||
|
|
*
|
||
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
||
|
|
* @OA\Schema(
|
||
|
|
*
|
||
|
|
* @OA\Property(property="data", ref="#/components/schemas/Site")
|
||
|
|
* )
|
||
|
|
* }
|
||
|
|
* )
|
||
|
|
* ),
|
||
|
|
*
|
||
|
|
* @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/sites/{id}",
|
||
|
|
* tags={"Sites"},
|
||
|
|
* 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() {}
|
||
|
|
}
|