Files
sam-api/app/Swagger/v1/NotificationSettingApi.php
hskwon a27b1b2091 feat: Phase 5.1-1 사용자 초대 + Phase 5.2 알림 설정 API 연동
- 사용자 초대 API: role 문자열 지원 추가 (React 호환)
- 알림 설정 API: 그룹 기반 계층 구조 구현
  - notification_setting_groups 테이블 추가
  - notification_setting_group_items 테이블 추가
  - notification_setting_group_states 테이블 추가
  - GET/PUT /api/v1/settings/notifications 엔드포인트 추가
- Pint 코드 스타일 정리
2025-12-22 17:42:59 +09:00

302 lines
12 KiB
PHP

<?php
namespace App\Swagger\v1;
/**
* @OA\Tag(
* name="NotificationSetting",
* description="알림 설정 관리"
* )
*
* @OA\Schema(
* schema="NotificationSettingItem",
* type="object",
*
* @OA\Property(property="notification_type", type="string", example="approval"),
* @OA\Property(property="label", type="string", example="전자결재"),
* @OA\Property(property="push_enabled", type="boolean", example=true),
* @OA\Property(property="email_enabled", type="boolean", example=false),
* @OA\Property(property="sms_enabled", type="boolean", example=false),
* @OA\Property(property="in_app_enabled", type="boolean", example=true),
* @OA\Property(property="kakao_enabled", type="boolean", example=false),
* @OA\Property(property="settings", type="object", nullable=true)
* )
*
* @OA\Schema(
* schema="NotificationSettingResponse",
* type="object",
*
* @OA\Property(
* property="settings",
* type="object",
* additionalProperties={"$ref": "#/components/schemas/NotificationSettingItem"}
* ),
* @OA\Property(
* property="types",
* type="object",
* description="알림 유형 레이블",
* example={"approval": "전자결재", "order": "수주", "deposit": "입금"}
* ),
* @OA\Property(
* property="channels",
* type="object",
* description="채널 레이블",
* example={"push": "푸시 알림", "email": "이메일", "sms": "SMS"}
* )
* )
*
* @OA\Schema(
* schema="UpdateNotificationSettingRequest",
* type="object",
* required={"notification_type"},
*
* @OA\Property(property="notification_type", type="string", enum={"approval", "order", "deposit", "withdrawal", "notice", "system", "marketing", "security"}, example="approval", description="알림 유형"),
* @OA\Property(property="push_enabled", type="boolean", nullable=true, example=true, description="푸시 알림 활성화"),
* @OA\Property(property="email_enabled", type="boolean", nullable=true, example=false, description="이메일 알림 활성화"),
* @OA\Property(property="sms_enabled", type="boolean", nullable=true, example=false, description="SMS 알림 활성화"),
* @OA\Property(property="in_app_enabled", type="boolean", nullable=true, example=true, description="인앱 알림 활성화"),
* @OA\Property(property="kakao_enabled", type="boolean", nullable=true, example=false, description="카카오 알림톡 활성화"),
* @OA\Property(property="settings", type="object", nullable=true, description="추가 설정")
* )
*
* @OA\Schema(
* schema="BulkUpdateNotificationSettingRequest",
* type="object",
* required={"settings"},
*
* @OA\Property(
* property="settings",
* type="array",
*
* @OA\Items(ref="#/components/schemas/UpdateNotificationSettingRequest")
* )
* )
*
* @OA\Schema(
* schema="NotificationSettingItemSimple",
* type="object",
* description="개별 알림 항목 설정",
*
* @OA\Property(property="enabled", type="boolean", example=true, description="알림 활성화"),
* @OA\Property(property="email", type="boolean", example=false, description="이메일 알림 활성화")
* )
*
* @OA\Schema(
* schema="NotificationSettingGrouped",
* type="object",
* description="그룹 기반 알림 설정 (React 호환)",
*
* @OA\Property(
* property="notice",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="notice", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="event", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="schedule",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=false),
* @OA\Property(property="vatReport", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="incomeTaxReport", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="vendor",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="newVendor", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="creditRating", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="attendance",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="annualLeave", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="clockIn", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="late", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="absent", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="order",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="salesOrder", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="purchaseOrder", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="approval",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="approvalRequest", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="draftApproved", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="draftRejected", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="draftCompleted", ref="#/components/schemas/NotificationSettingItemSimple")
* ),
* @OA\Property(
* property="production",
* type="object",
* @OA\Property(property="enabled", type="boolean", example=true),
* @OA\Property(property="safetyStock", ref="#/components/schemas/NotificationSettingItemSimple"),
* @OA\Property(property="productionComplete", ref="#/components/schemas/NotificationSettingItemSimple")
* )
* )
*/
class NotificationSettingApi
{
/**
* @OA\Get(
* path="/api/v1/users/me/notification-settings",
* operationId="getNotificationSettings",
* tags={"NotificationSetting"},
* summary="알림 설정 조회",
* description="현재 사용자의 알림 설정을 조회합니다.",
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
*
* @OA\Response(
* response=200,
* description="성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="조회 성공"),
* @OA\Property(property="data", ref="#/components/schemas/NotificationSettingResponse")
* )
* ),
*
* @OA\Response(response=401, description="인증 실패")
* )
*/
public function index() {}
/**
* @OA\Put(
* path="/api/v1/users/me/notification-settings",
* operationId="updateNotificationSetting",
* tags={"NotificationSetting"},
* summary="알림 설정 업데이트",
* description="특정 알림 유형의 설정을 업데이트합니다.",
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/UpdateNotificationSettingRequest")
* ),
*
* @OA\Response(
* response=200,
* description="수정 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="수정 성공"),
* @OA\Property(property="data", ref="#/components/schemas/NotificationSettingItem")
* )
* ),
*
* @OA\Response(response=401, description="인증 실패"),
* @OA\Response(response=422, description="유효성 검증 실패")
* )
*/
public function update() {}
/**
* @OA\Put(
* path="/api/v1/users/me/notification-settings/bulk",
* operationId="bulkUpdateNotificationSettings",
* tags={"NotificationSetting"},
* summary="알림 설정 일괄 업데이트",
* description="여러 알림 유형의 설정을 일괄 업데이트합니다.",
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/BulkUpdateNotificationSettingRequest")
* ),
*
* @OA\Response(
* response=200,
* description="일괄 저장 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="대량 저장 성공"),
* @OA\Property(
* property="data",
* type="array",
*
* @OA\Items(ref="#/components/schemas/NotificationSettingItem")
* )
* )
* ),
*
* @OA\Response(response=401, description="인증 실패"),
* @OA\Response(response=422, description="유효성 검증 실패")
* )
*/
public function bulkUpdate() {}
/**
* @OA\Get(
* path="/api/v1/settings/notifications",
* operationId="getGroupedNotificationSettings",
* tags={"NotificationSetting"},
* summary="그룹 기반 알림 설정 조회 (React 호환)",
* description="React 프론트엔드 구조에 맞춘 그룹 기반 알림 설정을 조회합니다.",
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
*
* @OA\Response(
* response=200,
* description="성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="조회 성공"),
* @OA\Property(property="data", ref="#/components/schemas/NotificationSettingGrouped")
* )
* ),
*
* @OA\Response(response=401, description="인증 실패")
* )
*/
public function indexGrouped() {}
/**
* @OA\Put(
* path="/api/v1/settings/notifications",
* operationId="updateGroupedNotificationSettings",
* tags={"NotificationSetting"},
* summary="그룹 기반 알림 설정 업데이트 (React 호환)",
* description="React 프론트엔드 구조에 맞춘 그룹 기반 알림 설정을 업데이트합니다.",
* security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/NotificationSettingGrouped")
* ),
*
* @OA\Response(
* response=200,
* description="수정 성공",
*
* @OA\JsonContent(
*
* @OA\Property(property="success", type="boolean", example=true),
* @OA\Property(property="message", type="string", example="수정 성공"),
* @OA\Property(property="data", ref="#/components/schemas/NotificationSettingGrouped")
* )
* ),
*
* @OA\Response(response=401, description="인증 실패"),
* @OA\Response(response=422, description="유효성 검증 실패")
* )
*/
public function updateGrouped() {}
}