From 0eb9fb85011cc8af660f0f54b5ae81618cbb7a0a Mon Sep 17 00:00:00 2001 From: hskwon Date: Wed, 17 Dec 2025 22:06:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[api-explorer]=20MNG=20API=20Explorer?= =?UTF-8?q?=EC=9A=A9=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - admin_api_bookmarks: 즐겨찾기 - admin_api_templates: 요청 템플릿 - admin_api_histories: 요청 히스토리 - admin_api_environments: 환경 설정 --- ...00001_create_admin_api_bookmarks_table.php | 35 +++++++++++++++++ ...00002_create_admin_api_templates_table.php | 39 +++++++++++++++++++ ...00003_create_admin_api_histories_table.php | 39 +++++++++++++++++++ ...04_create_admin_api_environments_table.php | 35 +++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 database/migrations/2025_12_17_200001_create_admin_api_bookmarks_table.php create mode 100644 database/migrations/2025_12_17_200002_create_admin_api_templates_table.php create mode 100644 database/migrations/2025_12_17_200003_create_admin_api_histories_table.php create mode 100644 database/migrations/2025_12_17_200004_create_admin_api_environments_table.php diff --git a/database/migrations/2025_12_17_200001_create_admin_api_bookmarks_table.php b/database/migrations/2025_12_17_200001_create_admin_api_bookmarks_table.php new file mode 100644 index 0000000..86bfff6 --- /dev/null +++ b/database/migrations/2025_12_17_200001_create_admin_api_bookmarks_table.php @@ -0,0 +1,35 @@ +id()->comment('ID'); + $table->foreignId('user_id')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->string('display_name', 100)->nullable()->comment('표시 이름'); + $table->integer('display_order')->default(0)->comment('표시 순서'); + $table->string('color', 20)->nullable()->comment('색상'); + $table->timestamps(); + + $table->unique(['user_id', 'endpoint', 'method']); + $table->index('user_id'); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + }); + } + + public function down(): void + { + Schema::dropIfExists('admin_api_bookmarks'); + } +}; diff --git a/database/migrations/2025_12_17_200002_create_admin_api_templates_table.php b/database/migrations/2025_12_17_200002_create_admin_api_templates_table.php new file mode 100644 index 0000000..e65a8a5 --- /dev/null +++ b/database/migrations/2025_12_17_200002_create_admin_api_templates_table.php @@ -0,0 +1,39 @@ +id()->comment('ID'); + $table->foreignId('user_id')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->string('name', 100)->comment('템플릿 이름'); + $table->text('description')->nullable()->comment('설명'); + $table->json('headers')->nullable()->comment('요청 헤더'); + $table->json('path_params')->nullable()->comment('경로 파라미터'); + $table->json('query_params')->nullable()->comment('쿼리 파라미터'); + $table->json('body')->nullable()->comment('요청 본문'); + $table->boolean('is_shared')->default(false)->comment('공유 여부'); + $table->timestamps(); + + $table->index(['user_id', 'endpoint', 'method']); + $table->index('is_shared'); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + }); + } + + public function down(): void + { + Schema::dropIfExists('admin_api_templates'); + } +}; diff --git a/database/migrations/2025_12_17_200003_create_admin_api_histories_table.php b/database/migrations/2025_12_17_200003_create_admin_api_histories_table.php new file mode 100644 index 0000000..154712a --- /dev/null +++ b/database/migrations/2025_12_17_200003_create_admin_api_histories_table.php @@ -0,0 +1,39 @@ +id()->comment('ID'); + $table->foreignId('user_id')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->json('request_headers')->nullable()->comment('요청 헤더'); + $table->json('request_body')->nullable()->comment('요청 본문'); + $table->integer('response_status')->comment('응답 상태 코드'); + $table->json('response_headers')->nullable()->comment('응답 헤더'); + $table->longText('response_body')->nullable()->comment('응답 본문'); + $table->integer('duration_ms')->comment('응답 시간(ms)'); + $table->string('environment', 50)->comment('실행 환경'); + $table->timestamp('created_at')->nullable(); + + $table->index(['user_id', 'created_at']); + $table->index(['endpoint', 'method']); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + }); + } + + public function down(): void + { + Schema::dropIfExists('admin_api_histories'); + } +}; diff --git a/database/migrations/2025_12_17_200004_create_admin_api_environments_table.php b/database/migrations/2025_12_17_200004_create_admin_api_environments_table.php new file mode 100644 index 0000000..424004e --- /dev/null +++ b/database/migrations/2025_12_17_200004_create_admin_api_environments_table.php @@ -0,0 +1,35 @@ +id()->comment('ID'); + $table->foreignId('user_id')->comment('사용자 ID'); + $table->string('name', 50)->comment('환경 이름'); + $table->string('base_url', 500)->comment('기본 URL'); + $table->string('api_key', 500)->nullable()->comment('API 키 (암호화)'); + $table->text('auth_token')->nullable()->comment('인증 토큰 (암호화)'); + $table->json('variables')->nullable()->comment('환경 변수'); + $table->boolean('is_default')->default(false)->comment('기본 환경 여부'); + $table->timestamps(); + + $table->index('user_id'); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->onDelete('cascade'); + }); + } + + public function down(): void + { + Schema::dropIfExists('admin_api_environments'); + } +};