feat: 대시보드 API 및 FCM 푸시 알림 API 구현

Dashboard API:
- DashboardController, DashboardService 추가
- /dashboard/summary, /charts, /approvals 엔드포인트

Push Notification API:
- FCM 토큰 관리 (등록/해제/목록)
- 알림 설정 관리 (유형별 on/off, 알림음 설정)
- 알림 유형: deposit, withdrawal, order, approval, attendance, notice, system
- 알림음: default, deposit, withdrawal, order, approval, urgent
- PushDeviceToken, PushNotificationSetting 모델
- Swagger 문서 추가
This commit is contained in:
2025-12-18 11:16:24 +09:00
parent 7089dd1e46
commit 6477cf2c83
15 changed files with 1697 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('push_device_tokens', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->unsignedBigInteger('user_id')->comment('사용자 ID');
$table->text('token')->comment('FCM 디바이스 토큰');
$table->string('platform', 20)->comment('플랫폼: ios, android, web');
$table->string('device_name')->nullable()->comment('디바이스명');
$table->string('app_version', 50)->nullable()->comment('앱 버전');
$table->boolean('is_active')->default(true)->comment('활성화 여부');
$table->timestamp('last_used_at')->nullable()->comment('마지막 사용 시간');
$table->timestamps();
$table->softDeletes();
// 인덱스
$table->index(['tenant_id', 'user_id']);
$table->index(['user_id', 'is_active']);
$table->index('platform');
});
}
public function down(): void
{
Schema::dropIfExists('push_device_tokens');
}
};

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('push_notification_settings', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->unsignedBigInteger('user_id')->comment('사용자 ID');
$table->string('notification_type', 50)->comment('알림 유형: deposit, withdrawal, order, approval 등');
$table->boolean('is_enabled')->default(true)->comment('알림 활성화 여부');
$table->string('sound', 100)->default('default')->comment('알림음 파일명');
$table->boolean('vibrate')->default(true)->comment('진동 여부');
$table->boolean('show_preview')->default(true)->comment('미리보기 표시 여부');
$table->timestamps();
// 복합 유니크 키
$table->unique(['tenant_id', 'user_id', 'notification_type'], 'push_settings_unique');
// 인덱스
$table->index(['tenant_id', 'user_id']);
});
}
public function down(): void
{
Schema::dropIfExists('push_notification_settings');
}
};