feat: Phase 8 SaaS 확장 - 구독관리/결제내역 API 추가

- 사용량 조회 API (GET /subscriptions/usage)
- 데이터 내보내기 API (POST/GET /subscriptions/export)
- 결제 명세서 API (GET /payments/{id}/statement)
- DataExport 모델 및 마이그레이션 추가
This commit is contained in:
2025-12-19 16:53:49 +09:00
parent 0d49e4cc75
commit abaff1286e
13 changed files with 868 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('data_exports', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete()->comment('테넌트 ID');
$table->string('export_type', 50)->comment('내보내기 유형: all, users, products, orders, clients');
$table->string('status', 20)->default('pending')->comment('상태: pending, processing, completed, failed');
$table->string('file_path')->nullable()->comment('생성된 파일 경로');
$table->string('file_name')->nullable()->comment('다운로드 파일명');
$table->unsignedBigInteger('file_size')->nullable()->comment('파일 크기 (bytes)');
$table->json('options')->nullable()->comment('내보내기 옵션');
$table->timestamp('started_at')->nullable()->comment('처리 시작 시간');
$table->timestamp('completed_at')->nullable()->comment('처리 완료 시간');
$table->text('error_message')->nullable()->comment('에러 메시지');
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete()->comment('생성자');
$table->timestamps();
$table->index(['tenant_id', 'status']);
$table->index(['tenant_id', 'created_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('data_exports');
}
};