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

573 lines
25 KiB
PHP
Raw Normal View History

<?php
namespace App\Swagger\v1;
use OpenApi\Annotations as OA;
/**
* 전역 태그 선언
*
* @OA\Tag(name="Tenant.Fields", description="테넌트별 필드 구동(효과값 조회/설정)")
* @OA\Tag(name="Tenant.Option Groups", description="테넌트 관리형 옵션 그룹")
* @OA\Tag(name="Tenant.Option Values", description="옵션 그룹의 항목(값) 관리")
* @OA\Tag(name="Tenant.Profiles", description="테넌트별 회원 프로필 조회/수정")
*/
class FieldProfileApi
{
/**
* Fields(효과값/설정) 스키마
*
* @OA\Schema(
* schema="FieldEffective",
* type="object",
* description="전역정의 + 테넌트설정이 merge된 필드 효과값",
* required={"field_key","label","data_type","input_type","enabled"},
* @OA\Property(property="field_key", type="string", example="position"),
* @OA\Property(property="label", type="string", example="직급"),
* @OA\Property(property="data_type", type="string", example="string"),
* @OA\Property(property="input_type", type="string", example="select"),
* @OA\Property(property="option_source", type="string", nullable=true, example="tenant_list"),
* @OA\Property(property="option_payload", type="object", nullable=true),
* @OA\Property(property="storage_area", type="string", example="tenant_profile"),
* @OA\Property(property="storage_key", type="string", example="position_key"),
* @OA\Property(property="is_core", type="boolean", example=false),
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="required", type="boolean", example=false),
* @OA\Property(property="sort_order", type="integer", example=10),
* @OA\Property(property="option_group_id", type="integer", nullable=true, example=5),
* @OA\Property(property="code_group", type="string", nullable=true, example="employment_type")
* )
*
* @OA\Schema(
* schema="FieldSettingUpdateRequest",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="required", type="boolean", example=false),
* @OA\Property(property="sort_order", type="integer", example=20),
* @OA\Property(property="option_group_id", type="integer", nullable=true, example=5),
* @OA\Property(property="code_group", type="string", nullable=true, example="department")
* )
*
* @OA\Schema(
* schema="FieldSettingBulkItem",
* type="object",
* required={"field_key"},
* @OA\Property(property="field_key", type="string", example="position"),
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="required", type="boolean", example=false),
* @OA\Property(property="sort_order", type="integer", example=10),
* @OA\Property(property="option_group_id", type="integer", nullable=true, example=5),
* @OA\Property(property="code_group", type="string", nullable=true, example="employment_type")
* )
* @OA\Schema(
* schema="FieldSettingBulkRequest",
* type="object",
* required={"items"},
* @OA\Property(
* property="items",
* type="array",
* @OA\Items(ref="#/components/schemas/FieldSettingBulkItem")
* )
* )
*/
public function _fieldSchemasNoop() {}
/**
* Option Group/Value 스키마
*
* @OA\Schema(
* schema="OptionGroup",
* type="object",
* required={"id","group_key","name"},
* @OA\Property(property="id", type="integer", example=3),
* @OA\Property(property="tenant_id", type="integer", example=1),
* @OA\Property(property="group_key", type="string", example="position"),
* @OA\Property(property="name", type="string", example="직급표(2025)"),
* @OA\Property(property="description", type="string", nullable=true, example="본사 기준")
* )
* @OA\Schema(
* schema="OptionGroupCreateRequest",
* type="object",
* required={"group_key","name"},
* @OA\Property(property="group_key", type="string", example="job_title"),
* @OA\Property(property="name", type="string", example="직책"),
* @OA\Property(property="description", type="string", nullable=true, example="영업조직용")
* )
* @OA\Schema(
* schema="OptionGroupUpdateRequest",
* type="object",
* @OA\Property(property="group_key", type="string", example="job_title"),
* @OA\Property(property="name", type="string", example="직책(개정)"),
* @OA\Property(property="description", type="string", nullable=true, example="영업/CS 통합")
* )
*
* @OA\Schema(
* schema="OptionValue",
* type="object",
* required={"id","group_id","value_key","value_label"},
* @OA\Property(property="id", type="integer", example=10),
* @OA\Property(property="group_id", type="integer", example=3),
* @OA\Property(property="value_key", type="string", example="manager"),
* @OA\Property(property="value_label", type="string", example="과장"),
* @OA\Property(property="sort_order", type="integer", example=30),
* @OA\Property(property="is_active", type="boolean", example=true)
* )
* @OA\Schema(
* schema="OptionValueCreateRequest",
* type="object",
* required={"value_key","value_label"},
* @OA\Property(property="value_key", type="string", example="director"),
* @OA\Property(property="value_label", type="string", example="이사"),
* @OA\Property(property="sort_order", type="integer", example=40),
* @OA\Property(property="is_active", type="boolean", example=true)
* )
* @OA\Schema(
* schema="OptionValueUpdateRequest",
* type="object",
* @OA\Property(property="value_key", type="string", example="director"),
* @OA\Property(property="value_label", type="string", example="이사"),
* @OA\Property(property="sort_order", type="integer", example=45),
* @OA\Property(property="is_active", type="boolean", example=false)
* )
* @OA\Schema(
* schema="OptionValueReorderRequest",
* type="object",
* required={"items"},
* @OA\Property(
* property="items",
* type="array",
* description="정렬 대상 목록",
* @OA\Items(
* type="object",
* required={"id","sort_order"},
* @OA\Property(property="id", type="integer", example=10),
* @OA\Property(property="sort_order", type="integer", example=100)
* )
* )
* )
*/
public function _optionSchemasNoop() {}
/**
* Profiles 스키마
*
* @OA\Schema(
* schema="Profile",
* type="object",
* description="테넌트별 사용자 프로필",
* required={"tenant_id","user_id"},
* @OA\Property(property="id", type="integer", example=101),
* @OA\Property(property="tenant_id", type="integer", example=1),
* @OA\Property(property="user_id", type="integer", example=55),
* @OA\Property(property="department_id", type="integer", nullable=true, example=12),
* @OA\Property(property="position_key", type="string", nullable=true, example="manager"),
* @OA\Property(property="job_title_key", type="string", nullable=true, example="lead_pm"),
* @OA\Property(property="work_location_key", type="string", nullable=true, example="seoul_hq"),
* @OA\Property(property="employment_type_key", type="string", nullable=true, example="regular"),
* @OA\Property(property="manager_user_id", type="integer", nullable=true, example=77),
* @OA\Property(property="display_name", type="string", nullable=true, example="김철수(영업1팀)"),
* @OA\Property(property="profile_photo_path", type="string", nullable=true, example="/uploads/tenant/1/avatar/55.png"),
* @OA\Property(property="json_extra", type="object", nullable=true,
* example={"employee_no":"A-001","entry_date":"2023-01-02","work_type":"hybrid"})
* )
* @OA\Schema(
* schema="ProfileUpdateRequest",
* type="object",
* description="프로필 수정 시, field_key: value 형태",
* example={
* "position":"manager",
* "employee_no":"A-001",
* "entry_date":"2023-01-02",
* "work_type":"hybrid"
* }
* )
* @OA\Schema(
* schema="ProfilePagination",
* type="object",
* description="LengthAwarePaginator 구조",
* @OA\Property(property="current_page", type="integer", example=1),
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Profile")),
* @OA\Property(property="total", type="integer", example=3),
* @OA\Property(property="per_page", type="integer", example=20),
* @OA\Property(property="path", type="string", example="/api/v1/profiles")
* )
*/
public function _profileSchemasNoop() {}
/* =========================
====== Endpoints ========
========================= */
/**
* @OA\Get(
* path="/api/v1/fields",
* summary="효과값 필드 목록",
* description="전역 필드 정의와 테넌트 설정을 병합한, 실제 화면 노출용(Enabled) 필드 목록을 반환합니다.",
* tags={"Tenant.Fields"},
* 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/FieldEffective")
* ))
* })
* ),
* @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 fieldsIndex() {}
/**
* @OA\Put(
* path="/api/v1/fields/bulk",
* summary="필드 설정 대량 저장",
* description="여러 필드에 대해 enabled/required/sort_order/option_group_id/code_group 설정을 한번에 저장합니다.",
* tags={"Tenant.Fields"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/FieldSettingBulkRequest")),
* @OA\Response(
* response=200,
* description="저장 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", type="object", example={"updated":true}))
* })
* ),
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function fieldsBulk() {}
/**
* @OA\Patch(
* path="/api/v1/fields/{key}",
* summary="필드 설정 단건 수정",
* description="특정 field_key에 대한 테넌트 설정을 수정합니다.",
* tags={"Tenant.Fields"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(
* name="key", in="path", required=true,
* description="수정할 필드 키", @OA\Schema(type="string", example="position")
* ),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/FieldSettingUpdateRequest")),
* @OA\Response(
* response=200,
* description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/FieldEffective"))
* })
* ),
* @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=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function fieldsUpdateOne() {}
/**
* @OA\Get(
* path="/api/v1/opt-groups",
* summary="옵션 그룹 목록",
* description="해당 테넌트의 옵션 그룹 목록을 페이징으로 반환합니다.",
* tags={"Tenant.Option Groups"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(ref="#/components/parameters/Page"),
* @OA\Parameter(ref="#/components/parameters/Size"),
* @OA\Parameter(name="q", in="query", required=false, description="검색어(그룹키/이름)", @OA\Schema(type="string", example="position")),
* @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/OptionGroup")),
* @OA\Property(property="total", type="integer", example=3)
* ))
* })
* ),
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function optGroupsIndex() {}
/**
* @OA\Post(
* path="/api/v1/opt-groups",
* summary="옵션 그룹 생성",
* description="옵션 그룹을 생성합니다.",
* tags={"Tenant.Option Groups"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/OptionGroupCreateRequest")),
* @OA\Response(response=200, description="생성 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/OptionGroup"))
* })
* )
* )
*/
public function optGroupsStore() {}
/**
* @OA\Get(
* path="/api/v1/opt-groups/{id}",
* summary="옵션 그룹 단건 조회",
* tags={"Tenant.Option Groups"},
* 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/OptionGroup"))
* })
* )
* )
*/
public function optGroupsShow() {}
/**
* @OA\Patch(
* path="/api/v1/opt-groups/{id}",
* summary="옵션 그룹 수정",
* tags={"Tenant.Option Groups"},
* 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/OptionGroupUpdateRequest")),
* @OA\Response(response=200, description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/OptionGroup"))
* })
* )
* )
*/
public function optGroupsUpdate() {}
/**
* @OA\Delete(
* path="/api/v1/opt-groups/{id}",
* summary="옵션 그룹 삭제",
* tags={"Tenant.Option Groups"},
* 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", type="object", nullable=true, example=null))
* })
* )
* )
*/
public function optGroupsDestroy() {}
/**
* @OA\Get(
* path="/api/v1/opt-groups/{gid}/values",
* summary="옵션 값 목록",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\Parameter(name="active_only", in="query", required=false, @OA\Schema(type="boolean", example=true)),
* @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/OptionValue")))
* })
* )
* )
*/
public function optionValuesIndex() {}
/**
* @OA\Post(
* path="/api/v1/opt-groups/{gid}/values",
* summary="옵션 값 생성",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/OptionValueCreateRequest")),
* @OA\Response(response=200, description="생성 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/OptionValue"))
* })
* )
* )
*/
public function optionValuesStore() {}
/**
* @OA\Get(
* path="/api/v1/opt-groups/{gid}/values/{id}",
* summary="옵션 값 단건 조회",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=10)),
* @OA\Response(response=200, description="성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/OptionValue"))
* })
* )
* )
*/
public function optionValuesShow() {}
/**
* @OA\Patch(
* path="/api/v1/opt-groups/{gid}/values/{id}",
* summary="옵션 값 수정",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=10)),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/OptionValueUpdateRequest")),
* @OA\Response(response=200, description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/OptionValue"))
* })
* )
* )
*/
public function optionValuesUpdate() {}
/**
* @OA\Delete(
* path="/api/v1/opt-groups/{gid}/values/{id}",
* summary="옵션 값 삭제",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer", example=10)),
* @OA\Response(response=200, description="삭제 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", type="object", nullable=true, example=null))
* })
* )
* )
*/
public function optionValuesDestroy() {}
/**
* @OA\Patch(
* path="/api/v1/opt-groups/{gid}/values/reorder",
* summary="옵션 값 정렬 순서 일괄 변경",
* tags={"Tenant.Option Values"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="gid", in="path", required=true, @OA\Schema(type="integer", example=3)),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/OptionValueReorderRequest")),
* @OA\Response(response=200, description="변경 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", type="object", example={"reordered":true}))
* })
* )
* )
*/
public function optionValuesReorder() {}
/**
* @OA\Get(
* path="/api/v1/profiles",
* summary="프로필 목록",
* description="테넌트 내 회원 프로필 목록을 페이징으로 반환합니다.",
* tags={"Tenant.Profiles"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(ref="#/components/parameters/Page"),
* @OA\Parameter(ref="#/components/parameters/Size"),
* @OA\Parameter(name="q", in="query", required=false, description="검색어(표기명/사번 등)", @OA\Schema(type="string", example="A-001")),
* @OA\Response(response=200, description="성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ProfilePagination"))
* })
* )
* )
*/
public function profilesIndex() {}
/**
* @OA\Get(
* path="/api/v1/profiles/{userId}",
* summary="프로필 단건 조회",
* tags={"Tenant.Profiles"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="userId", in="path", required=true, @OA\Schema(type="integer", example=55)),
* @OA\Response(response=200, description="성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Profile"))
* })
* )
* )
*/
public function profilesShow() {}
/**
* @OA\Patch(
* path="/api/v1/profiles/{userId}",
* summary="프로필 수정(관리자)",
* description="관리자 권한으로 해당 사용자의 프로필을 수정합니다. 테넌트에서 enabled된 필드만 반영됩니다.",
* tags={"Tenant.Profiles"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Parameter(name="userId", in="path", required=true, @OA\Schema(type="integer", example=55)),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ProfileUpdateRequest")),
* @OA\Response(response=200, description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Profile"))
* })
* )
* )
*/
public function profilesUpdate() {}
/**
* @OA\Get(
* path="/api/v1/profiles/me",
* summary="내 프로필 조회",
* tags={"Tenant.Profiles"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\Response(response=200, description="성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Profile"))
* })
* )
* )
*/
public function profilesMe() {}
/**
* @OA\Patch(
* path="/api/v1/profiles/me",
* summary="내 프로필 수정",
* tags={"Tenant.Profiles"},
* security={{"ApiKeyAuth": {}},{"BearerAuth": {}}},
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ProfileUpdateRequest")),
* @OA\Response(response=200, description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Profile"))
* })
* )
* )
*/
public function profilesUpdateMe() {}
}