51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Api\V1;
|
||
|
|
|
||
|
|
use App\Helpers\ApiResponse;
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Http\Requests\NotificationSetting\BulkUpdateSettingRequest;
|
||
|
|
use App\Http\Requests\NotificationSetting\UpdateSettingRequest;
|
||
|
|
use App\Services\NotificationSettingService;
|
||
|
|
use Illuminate\Http\JsonResponse;
|
||
|
|
|
||
|
|
class NotificationSettingController extends Controller
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
private readonly NotificationSettingService $service
|
||
|
|
) {}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 알림 설정 조회
|
||
|
|
*/
|
||
|
|
public function index(): JsonResponse
|
||
|
|
{
|
||
|
|
return ApiResponse::handle(
|
||
|
|
fn () => $this->service->getSettings(),
|
||
|
|
__('message.fetched')
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 알림 설정 업데이트 (단일)
|
||
|
|
*/
|
||
|
|
public function update(UpdateSettingRequest $request): JsonResponse
|
||
|
|
{
|
||
|
|
return ApiResponse::handle(
|
||
|
|
fn () => $this->service->updateSetting($request->validated()),
|
||
|
|
__('message.updated')
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 알림 설정 일괄 업데이트
|
||
|
|
*/
|
||
|
|
public function bulkUpdate(BulkUpdateSettingRequest $request): JsonResponse
|
||
|
|
{
|
||
|
|
return ApiResponse::handle(
|
||
|
|
fn () => $this->service->bulkUpdateSettings($request->validated()['settings']),
|
||
|
|
__('message.bulk_upsert')
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|