From 75e73542ffd33b2d8b10bb3d09eab48a6f969b13 Mon Sep 17 00:00:00 2001 From: RD-Hank Date: Mon, 12 May 2025 01:23:12 +0800 Subject: [PATCH] =?UTF-8?q?docs:api=E6=96=87=E6=AA=94=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Docs/AuthApiDoc.php | 1146 +++++++ composer.json | 1 + composer.lock | 499 ++- config/l5-swagger.php | 319 ++ resources/views/vendor/l5-swagger/.gitkeep | 0 .../views/vendor/l5-swagger/index.blade.php | 174 + storage/api-docs/api-docs.json | 2966 +++++++++++++++++ 7 files changed, 5032 insertions(+), 73 deletions(-) create mode 100644 app/Docs/AuthApiDoc.php create mode 100644 config/l5-swagger.php create mode 100644 resources/views/vendor/l5-swagger/.gitkeep create mode 100644 resources/views/vendor/l5-swagger/index.blade.php create mode 100644 storage/api-docs/api-docs.json diff --git a/app/Docs/AuthApiDoc.php b/app/Docs/AuthApiDoc.php new file mode 100644 index 0000000..c3c4fc0 --- /dev/null +++ b/app/Docs/AuthApiDoc.php @@ -0,0 +1,1146 @@ +=5.18.3", + "symfony/yaml": "^5.0 || ^6.0 || ^7.0", + "zircote/swagger-php": "^5.0.0" + }, + "require-dev": { + "mockery/mockery": "1.*", + "orchestra/testbench": "^10.0 || ^9.0 || ^8.0 || 7.* || ^6.15 || 5.*", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "L5Swagger": "L5Swagger\\L5SwaggerFacade" + }, + "providers": [ + "L5Swagger\\L5SwaggerServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "L5Swagger\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Darius Matulionis", + "email": "darius@matulionis.lt" + } + ], + "description": "OpenApi or Swagger integration to Laravel", + "keywords": [ + "api", + "documentation", + "laravel", + "openapi", + "specification", + "swagger", + "ui" + ], + "support": { + "issues": "https://github.com/DarkaOnLine/L5-Swagger/issues", + "source": "https://github.com/DarkaOnLine/L5-Swagger/tree/9.0.1" + }, + "funding": [ + { + "url": "https://github.com/DarkaOnLine", + "type": "github" + } + ], + "time": "2025-02-28T06:25:02+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.3", @@ -210,6 +291,82 @@ }, "time": "2024-07-08T12:26:09+00:00" }, + { + "name": "doctrine/annotations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/901c2ee5d26eb64ff43c47976e114bf00843acf7", + "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^2 || ^3", + "ext-tokenizer": "*", + "php": "^7.2 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^2.0", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.10.28", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^5.4 || ^6.4 || ^7", + "vimeo/psalm": "^4.30 || ^5.14" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/2.0.2" + }, + "time": "2024-09-05T10:17:24+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.10", @@ -3085,6 +3242,55 @@ ], "time": "2024-12-14T21:12:59+00:00" }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, { "name": "psr/clock", "version": "1.0.0", @@ -3788,6 +3994,67 @@ ], "time": "2024-04-27T21:32:50+00:00" }, + { + "name": "swagger-api/swagger-ui", + "version": "v5.21.0", + "source": { + "type": "git", + "url": "https://github.com/swagger-api/swagger-ui.git", + "reference": "fceaec605072fbc717a04895bd19814d9a1c8e6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/fceaec605072fbc717a04895bd19814d9a1c8e6d", + "reference": "fceaec605072fbc717a04895bd19814d9a1c8e6d", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Anna Bodnia", + "email": "anna.bodnia@gmail.com" + }, + { + "name": "Buu Nguyen", + "email": "buunguyen@gmail.com" + }, + { + "name": "Josh Ponelat", + "email": "jponelat@gmail.com" + }, + { + "name": "Kyle Shockey", + "email": "kyleshockey1@gmail.com" + }, + { + "name": "Robert Barnwell", + "email": "robert@robertismy.name" + }, + { + "name": "Sahar Jafari", + "email": "shr.jafari@gmail.com" + } + ], + "description": " Swagger UI is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.", + "homepage": "http://swagger.io", + "keywords": [ + "api", + "documentation", + "openapi", + "specification", + "swagger", + "ui" + ], + "support": { + "issues": "https://github.com/swagger-api/swagger-ui/issues", + "source": "https://github.com/swagger-api/swagger-ui/tree/v5.21.0" + }, + "time": "2025-04-13T19:37:38+00:00" + }, { "name": "symfony/clock", "version": "v7.2.0", @@ -6017,6 +6284,78 @@ ], "time": "2025-04-09T08:14:01+00:00" }, + { + "name": "symfony/yaml", + "version": "v7.2.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "0feafffb843860624ddfd13478f481f4c3cd8b23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/0feafffb843860624ddfd13478f481f4c3cd8b23", + "reference": "0feafffb843860624ddfd13478f481f4c3cd8b23", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/console": "<6.4" + }, + "require-dev": { + "symfony/console": "^6.4|^7.0" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v7.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-04-04T10:10:11+00:00" + }, { "name": "tijsverkoyen/css-to-inline-styles", "version": "v2.3.0", @@ -6287,6 +6626,92 @@ "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, "time": "2022-06-03T18:03:27+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "7a6544c60441ddb5959b91266b3a290dc28537ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7a6544c60441ddb5959b91266b3a290dc28537ba", + "reference": "7a6544c60441ddb5959b91266b3a290dc28537ba", + "shasum": "" + }, + "require": { + "ext-json": "*", + "nikic/php-parser": "^4.19 || ^5.0", + "php": ">=7.4", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": "^5.0 || ^6.0 || ^7.0", + "symfony/yaml": "^5.0 || ^6.0 || ^7.0" + }, + "conflict": { + "symfony/process": ">=6, <6.4.14" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^2.0", + "friendsofphp/php-cs-fixer": "^3.62.0", + "phpstan/phpstan": "^1.6 || ^2.0", + "phpunit/phpunit": "^9.0", + "rector/rector": "^1.0 || ^2.0", + "vimeo/psalm": "^4.30 || ^5.0" + }, + "suggest": { + "doctrine/annotations": "^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "https://bfanger.nl" + }, + { + "name": "Martin Rademacher", + "email": "mano@radebatz.net", + "homepage": "https://radebatz.net" + } + ], + "description": "Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations", + "homepage": "https://github.com/zircote/swagger-php", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/5.1.1" + }, + "time": "2025-04-27T10:02:08+00:00" } ], "packages-dev": [ @@ -8688,78 +9113,6 @@ ], "time": "2024-06-12T15:01:18+00:00" }, - { - "name": "symfony/yaml", - "version": "v7.2.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "0feafffb843860624ddfd13478f481f4c3cd8b23" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/0feafffb843860624ddfd13478f481f4c3cd8b23", - "reference": "0feafffb843860624ddfd13478f481f4c3cd8b23", - "shasum": "" - }, - "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<6.4" - }, - "require-dev": { - "symfony/console": "^6.4|^7.0" - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v7.2.6" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2025-04-04T10:10:11+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.3", diff --git a/config/l5-swagger.php b/config/l5-swagger.php new file mode 100644 index 0000000..d7810ff --- /dev/null +++ b/config/l5-swagger.php @@ -0,0 +1,319 @@ + 'default', + 'documentations' => [ + 'default' => [ + 'api' => [ + 'title' => 'L5 Swagger UI', + ], + + 'routes' => [ + /* + * Route for accessing api documentation interface + */ + 'api' => 'api/documentation', + ], + 'paths' => [ + /* + * Edit to include full URL in ui for assets + */ + 'use_absolute_path' => env('L5_SWAGGER_USE_ABSOLUTE_PATH', true), + + /* + * Edit to set path where swagger ui assets should be stored + */ + 'swagger_ui_assets_path' => env('L5_SWAGGER_UI_ASSETS_PATH', 'vendor/swagger-api/swagger-ui/dist/'), + + /* + * File name of the generated json documentation file + */ + 'docs_json' => 'api-docs.json', + + /* + * File name of the generated YAML documentation file + */ + 'docs_yaml' => 'api-docs.yaml', + + /* + * Set this to `json` or `yaml` to determine which documentation file to use in UI + */ + 'format_to_use_for_docs' => env('L5_FORMAT_TO_USE_FOR_DOCS', 'json'), + + /* + * Absolute paths to directory containing the swagger annotations are stored. + */ + 'annotations' => [ + base_path('app/Docs'), + base_path('app/Models'), + ], + ], + ], + ], + 'defaults' => [ + 'routes' => [ + /* + * Route for accessing parsed swagger annotations. + */ + 'docs' => 'docs', + + /* + * Route for Oauth2 authentication callback. + */ + 'oauth2_callback' => 'api/oauth2-callback', + + /* + * Middleware allows to prevent unexpected access to API documentation + */ + 'middleware' => [ + 'api' => [], + 'asset' => [], + 'docs' => [], + 'oauth2_callback' => [], + ], + + /* + * Route Group options + */ + 'group_options' => [], + ], + + 'paths' => [ + /* + * Absolute path to location where parsed annotations will be stored + */ + 'docs' => storage_path('api-docs'), + + /* + * Absolute path to directory where to export views + */ + 'views' => base_path('resources/views/vendor/l5-swagger'), + + /* + * Edit to set the api's base path + */ + 'base' => env('L5_SWAGGER_BASE_PATH', null), + + /* + * Absolute path to directories that should be excluded from scanning + * @deprecated Please use `scanOptions.exclude` + * `scanOptions.exclude` overwrites this + */ + 'excludes' => [], + ], + + 'scanOptions' => [ + /** + * Configuration for default processors. Allows to pass processors configuration to swagger-php. + * + * @link https://zircote.github.io/swagger-php/reference/processors.html + */ + 'default_processors_configuration' => [ + /** Example */ + /** + * 'operationId.hash' => true, + * 'pathFilter' => [ + * 'tags' => [ + * '/pets/', + * '/store/', + * ], + * ],. + */ + ], + + /** + * analyser: defaults to \OpenApi\StaticAnalyser . + * + * @see \OpenApi\scan + */ + 'analyser' => null, + + /** + * analysis: defaults to a new \OpenApi\Analysis . + * + * @see \OpenApi\scan + */ + 'analysis' => null, + + /** + * Custom query path processors classes. + * + * @link https://github.com/zircote/swagger-php/tree/master/Examples/processors/schema-query-parameter + * @see \OpenApi\scan + */ + 'processors' => [ + // new \App\SwaggerProcessors\SchemaQueryParameter(), + ], + + /** + * pattern: string $pattern File pattern(s) to scan (default: *.php) . + * + * @see \OpenApi\scan + */ + 'pattern' => null, + + /* + * Absolute path to directories that should be excluded from scanning + * @note This option overwrites `paths.excludes` + * @see \OpenApi\scan + */ + 'exclude' => [], + + /* + * Allows to generate specs either for OpenAPI 3.0.0 or OpenAPI 3.1.0. + * By default the spec will be in version 3.0.0 + */ + 'open_api_spec_version' => env('L5_SWAGGER_OPEN_API_SPEC_VERSION', \L5Swagger\Generator::OPEN_API_DEFAULT_SPEC_VERSION), + ], + + /* + * API security definitions. Will be generated into documentation file. + */ + 'securityDefinitions' => [ + 'securitySchemes' => [ + /* + * Examples of Security schemes + */ + /* + 'api_key_security_example' => [ // Unique name of security + 'type' => 'apiKey', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'A short description for security scheme', + 'name' => 'api_key', // The name of the header or query parameter to be used. + 'in' => 'header', // The location of the API key. Valid values are "query" or "header". + ], + 'oauth2_security_example' => [ // Unique name of security + 'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'A short description for oauth2 security scheme.', + 'flow' => 'implicit', // The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". + 'authorizationUrl' => 'http://example.com/auth', // The authorization URL to be used for (implicit/accessCode) + //'tokenUrl' => 'http://example.com/auth' // The authorization URL to be used for (password/application/accessCode) + 'scopes' => [ + 'read:projects' => 'read your projects', + 'write:projects' => 'modify projects in your account', + ] + ], + */ + + /* Open API 3.0 support + 'passport' => [ // Unique name of security + 'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'Laravel passport oauth2 security.', + 'in' => 'header', + 'scheme' => 'https', + 'flows' => [ + "password" => [ + "authorizationUrl" => config('app.url') . '/oauth/authorize', + "tokenUrl" => config('app.url') . '/oauth/token', + "refreshUrl" => config('app.url') . '/token/refresh', + "scopes" => [] + ], + ], + ], + 'sanctum' => [ // Unique name of security + 'type' => 'apiKey', // Valid values are "basic", "apiKey" or "oauth2". + 'description' => 'Enter token in format (Bearer )', + 'name' => 'Authorization', // The name of the header or query parameter to be used. + 'in' => 'header', // The location of the API key. Valid values are "query" or "header". + ], + */ + ], + 'security' => [ + /* + * Examples of Securities + */ + [ + /* + 'oauth2_security_example' => [ + 'read', + 'write' + ], + + 'passport' => [] + */ + ], + ], + ], + + /* + * Set this to `true` in development mode so that docs would be regenerated on each request + * Set this to `false` to disable swagger generation on production + */ + 'generate_always' => env('L5_SWAGGER_GENERATE_ALWAYS', false), + + /* + * Set this to `true` to generate a copy of documentation in yaml format + */ + 'generate_yaml_copy' => env('L5_SWAGGER_GENERATE_YAML_COPY', false), + + /* + * Edit to trust the proxy's ip address - needed for AWS Load Balancer + * string[] + */ + 'proxy' => false, + + /* + * Configs plugin allows to fetch external configs instead of passing them to SwaggerUIBundle. + * See more at: https://github.com/swagger-api/swagger-ui#configs-plugin + */ + 'additional_config_url' => null, + + /* + * Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), + * 'method' (sort by HTTP method). + * Default is the order returned by the server unchanged. + */ + 'operations_sort' => env('L5_SWAGGER_OPERATIONS_SORT', null), + + /* + * Pass the validatorUrl parameter to SwaggerUi init on the JS side. + * A null value here disables validation. + */ + 'validator_url' => null, + + /* + * Swagger UI configuration parameters + */ + 'ui' => [ + 'display' => [ + 'dark_mode' => env('L5_SWAGGER_UI_DARK_MODE', false), + /* + * Controls the default expansion setting for the operations and tags. It can be : + * 'list' (expands only the tags), + * 'full' (expands the tags and operations), + * 'none' (expands nothing). + */ + 'doc_expansion' => env('L5_SWAGGER_UI_DOC_EXPANSION', 'none'), + + /** + * If set, enables filtering. The top bar will show an edit box that + * you can use to filter the tagged operations that are shown. Can be + * Boolean to enable or disable, or a string, in which case filtering + * will be enabled using that string as the filter expression. Filtering + * is case-sensitive matching the filter expression anywhere inside + * the tag. + */ + 'filter' => env('L5_SWAGGER_UI_FILTERS', true), // true | false + ], + + 'authorization' => [ + /* + * If set to true, it persists authorization data, and it would not be lost on browser close/refresh + */ + 'persist_authorization' => env('L5_SWAGGER_UI_PERSIST_AUTHORIZATION', false), + + 'oauth2' => [ + /* + * If set to true, adds PKCE to AuthorizationCodeGrant flow + */ + 'use_pkce_with_authorization_code_grant' => false, + ], + ], + ], + /* + * Constants which can be used in annotations + */ + 'constants' => [ + 'L5_SWAGGER_CONST_HOST' => env('L5_SWAGGER_CONST_HOST', 'http://my-default-host.com'), + ], + ], +]; diff --git a/resources/views/vendor/l5-swagger/.gitkeep b/resources/views/vendor/l5-swagger/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/vendor/l5-swagger/index.blade.php b/resources/views/vendor/l5-swagger/index.blade.php new file mode 100644 index 0000000..4f57040 --- /dev/null +++ b/resources/views/vendor/l5-swagger/index.blade.php @@ -0,0 +1,174 @@ + + + + + {{ $documentationTitle }} + + + + + @if(config('l5-swagger.defaults.ui.display.dark_mode')) + + @endif + + + +
+ + + + + + diff --git a/storage/api-docs/api-docs.json b/storage/api-docs/api-docs.json new file mode 100644 index 0000000..50fb8e8 --- /dev/null +++ b/storage/api-docs/api-docs.json @@ -0,0 +1,2966 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "CFDive Platform API", + "description": "CFDive Platform API 文檔", + "version": "1.0.0" + }, + "servers": [ + { + "url": "/api", + "description": "API 伺服器" + } + ], + "paths": { + "/register/member": { + "post": { + "tags": [ + "會員" + ], + "summary": "會員註冊", + "description": "建立新的會員帳號", + "operationId": "registerMember", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "name", + "email", + "password", + "password_confirmation" + ], + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "王小明" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "member@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "password_confirmation": { + "description": "確認密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0912345678" + }, + "birthday": { + "description": "生日", + "type": "string", + "format": "date", + "example": "1990-01-01" + }, + "gender": { + "description": "性別", + "type": "string", + "enum": [ + "male", + "female", + "other" + ], + "example": "male" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "201": { + "description": "會員註冊成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "會員註冊成功" + }, + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "王小明" + }, + "email": { + "type": "string", + "example": "user@example.com" + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "member" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "email_verified_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "memberProfile": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "user_id": { + "type": "integer", + "example": 1 + }, + "birthday": { + "type": "string", + "example": "1990-01-01" + }, + "gender": { + "type": "string", + "example": "male" + }, + "address": { + "type": "string", + "example": "台北市信義區某街123號" + }, + "emergency_contact": { + "type": "string", + "example": "王大明" + }, + "emergency_phone": { + "type": "string", + "example": "0987654321" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "token": { + "type": "string", + "example": "1|abcdef1234567890" + }, + "token_type": { + "type": "string", + "example": "Bearer" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/login/member": { + "post": { + "tags": [ + "會員" + ], + "summary": "會員登入", + "description": "會員帳號登入系統", + "operationId": "loginMember", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "member@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "登入成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "登入成功" + }, + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 11 + }, + "name": { + "type": "string", + "example": "測試會員" + }, + "email": { + "type": "string", + "example": "test_member@example.com" + }, + "email_verified_at": { + "type": "string", + "example": null, + "nullable": true + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "member" + }, + "is_active": { + "type": "integer", + "example": 1 + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "member_profile": { + "properties": { + "id": { + "type": "integer", + "example": 5 + }, + "user_id": { + "type": "integer", + "example": 11 + }, + "birthday": { + "type": "string", + "example": "1990-01-01T00:00:00.000000Z" + }, + "gender": { + "type": "string", + "example": "male" + }, + "address": { + "type": "string", + "example": null, + "nullable": true + }, + "emergency_contact": { + "type": "string", + "example": null, + "nullable": true + }, + "emergency_phone": { + "type": "string", + "example": null, + "nullable": true + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "token": { + "type": "string", + "example": "23|ZuJ6m0Ls4FSJITsOoqWtFtacazXyXwUtZtkcTb960e5a08" + }, + "token_type": { + "type": "string", + "example": "Bearer" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "身份驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "電子郵件或密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "帳號已被停用", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "帳號已被停用" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/logout/member": { + "post": { + "tags": [ + "會員" + ], + "summary": "會員登出", + "description": "會員登出系統並撤銷當前令牌", + "operationId": "logoutMember", + "responses": { + "200": { + "description": "登出成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "會員登出成功" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/profile/member": { + "get": { + "tags": [ + "會員" + ], + "summary": "取得會員個人資料", + "description": "取得當前登入會員的個人資料", + "operationId": "memberProfile", + "responses": { + "200": { + "description": "取得資料成功", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "王小明" + }, + "email": { + "type": "string", + "example": "user@example.com" + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "member" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "email_verified_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "memberProfile": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "user_id": { + "type": "integer", + "example": 1 + }, + "birthday": { + "type": "string", + "example": "1990-01-01" + }, + "gender": { + "type": "string", + "example": "male" + }, + "address": { + "type": "string", + "example": "台北市信義區某街123號" + }, + "emergency_contact": { + "type": "string", + "example": "王大明" + }, + "emergency_phone": { + "type": "string", + "example": "0987654321" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + }, + "put": { + "tags": [ + "會員" + ], + "summary": "更新會員個人資料", + "description": "更新當前登入會員的個人資料", + "operationId": "updateMemberProfile", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "王大明" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "newmail@example.com" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0987654321" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "更新成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "會員資料已更新" + }, + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "王大明" + }, + "email": { + "type": "string", + "example": "user@example.com" + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "member" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "email_verified_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "memberProfile": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "user_id": { + "type": "integer", + "example": 1 + }, + "birthday": { + "type": "string", + "example": "1990-01-01" + }, + "gender": { + "type": "string", + "example": "male" + }, + "address": { + "type": "string", + "example": "台北市信義區某街123號" + }, + "emergency_contact": { + "type": "string", + "example": "王大明" + }, + "emergency_phone": { + "type": "string", + "example": "0987654321" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/password/member": { + "post": { + "tags": [ + "會員" + ], + "summary": "修改會員密碼", + "description": "修改當前登入會員的密碼", + "operationId": "changeMemberPassword", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "current_password", + "password", + "password_confirmation" + ], + "properties": { + "current_password": { + "description": "目前密碼", + "type": "string", + "format": "password", + "example": "oldpassword" + }, + "password": { + "description": "新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + }, + "password_confirmation": { + "description": "確認新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "修改成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "密碼修改成功" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "目前密碼錯誤", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "目前密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/register/provider": { + "post": { + "tags": [ + "服務提供者" + ], + "summary": "服務提供者註冊", + "description": "建立新的服務提供者帳號", + "operationId": "registerProvider", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "name", + "email", + "password", + "password_confirmation" + ], + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "林教練" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "coach@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "password_confirmation": { + "description": "確認密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0912345678" + }, + "business_name": { + "description": "業者名稱", + "type": "string", + "example": "藍海潛水中心" + }, + "description": { + "description": "業者描述", + "type": "string", + "example": "專業潛水中心,提供各種潛水服務" + }, + "contact_person": { + "description": "聯絡人", + "type": "string", + "example": "羅大師" + }, + "contact_phone": { + "description": "聯絡電話", + "type": "string", + "example": "0912345678" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "201": { + "description": "服務提供者註冊成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "服務提供者註冊成功" + }, + "data": { + "properties": { + "user": { + "$ref": "#/components/schemas/User" + }, + "token": { + "type": "string", + "example": "1|abcdef1234567890" + }, + "token_type": { + "type": "string", + "example": "Bearer" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/login/provider": { + "post": { + "tags": [ + "服務提供者" + ], + "summary": "服務提供者登入", + "description": "服務提供者帳號登入系統", + "operationId": "loginProvider", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "coach@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "登入成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "data": { + "properties": { + "id": { + "type": "integer", + "example": 11 + }, + "name": { + "type": "string", + "example": "測試服務提供者" + }, + "email": { + "type": "string", + "example": "test_provider@example.com" + }, + "email_verified_at": { + "type": "string", + "example": null, + "nullable": true + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "provider" + }, + "is_active": { + "type": "integer", + "example": 1 + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "providerProfile": { + "properties": { + "id": { + "type": "integer", + "example": 5 + }, + "user_id": { + "type": "integer", + "example": 11 + }, + "business_name": { + "type": "string", + "example": "藍海潛水中心" + }, + "description": { + "type": "string", + "example": "專業潛水中心,提供各種潛水服務" + }, + "contact_person": { + "type": "string", + "example": "王大師" + }, + "contact_phone": { + "type": "string", + "example": "0912345678" + }, + "contact_email": { + "type": "string", + "example": "contact@example.com" + }, + "address": { + "type": "string", + "example": "台灣屏東縣恆春鎮XXX路123號" + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "身份驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "電子郵件或密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "帳號已被停用", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "帳號已被停用" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/logout/provider": { + "post": { + "tags": [ + "服務提供者" + ], + "summary": "服務提供者登出", + "description": "服務提供者登出系統並撤銷當前令牌", + "operationId": "logoutProvider", + "responses": { + "200": { + "description": "登出成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "服務提供者登出成功" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/profile/provider": { + "get": { + "tags": [ + "服務提供者" + ], + "summary": "取得服務提供者資料", + "description": "取得當前登入服務提供者的資料", + "operationId": "providerProfile", + "responses": { + "200": { + "description": "取得資料成功", + "content": { + "application/json": { + "schema": { + "properties": { + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "測試服務提供者" + }, + "email": { + "type": "string", + "example": "provider@example.com" + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "provider" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "email_verified_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "providerProfile": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "user_id": { + "type": "integer", + "example": 1 + }, + "business_name": { + "type": "string", + "example": "藍海潛水中心" + }, + "description": { + "type": "string", + "example": "專業潛水中心,提供各種潛水服務" + }, + "contact_person": { + "type": "string", + "example": "王大師" + }, + "contact_phone": { + "type": "string", + "example": "0912345678" + }, + "contact_email": { + "type": "string", + "example": "contact@example.com" + }, + "address": { + "type": "string", + "example": "台灣屏東縣恆春鎮XXX路123號" + }, + "business_hours": { + "type": "string", + "example": "週一至週五 09:00-18:00" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + }, + "put": { + "tags": [ + "服務提供者" + ], + "summary": "更新服務提供者資料", + "description": "更新當前登入服務提供者的資料", + "operationId": "updateProviderProfile", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "藍海潛水中心" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "newprovider@example.com" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0987654321" + }, + "business_name": { + "description": "業者名稱", + "type": "string", + "example": "藍海潛水中心新分院" + }, + "description": { + "description": "業者描述", + "type": "string", + "example": "專業潛水中心,提供各種高品質潛水課程與行程" + }, + "contact_person": { + "description": "聯絡人", + "type": "string", + "example": "王大師" + }, + "address": { + "description": "營業地址", + "type": "string", + "example": "台灣屏東縣恆春鎮XXX路456號" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "更新成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "服務提供者資料已更新" + }, + "data": { + "properties": { + "user": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "name": { + "type": "string", + "example": "藍海潛水中心" + }, + "email": { + "type": "string", + "example": "provider@example.com" + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "provider" + }, + "is_active": { + "type": "boolean", + "example": true + }, + "email_verified_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "providerProfile": { + "properties": { + "id": { + "type": "integer", + "example": 1 + }, + "user_id": { + "type": "integer", + "example": 1 + }, + "business_name": { + "type": "string", + "example": "藍海潛水中心" + }, + "description": { + "type": "string", + "example": "專業潛水中心,提供各種潛水服務" + }, + "contact_person": { + "type": "string", + "example": "王大師" + }, + "contact_phone": { + "type": "string", + "example": "0912345678" + }, + "contact_email": { + "type": "string", + "example": "contact@example.com" + }, + "address": { + "type": "string", + "example": "台灣屏東縣恆春鎮XXX路123號" + }, + "business_hours": { + "type": "string", + "example": "週一至週五 09:00-18:00" + }, + "created_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/password/provider": { + "post": { + "tags": [ + "服務提供者" + ], + "summary": "修改服務提供者密碼", + "description": "修改當前登入服務提供者的密碼", + "operationId": "changeProviderPassword", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "current_password", + "password", + "password_confirmation" + ], + "properties": { + "current_password": { + "description": "目前密碼", + "type": "string", + "format": "password", + "example": "oldpassword" + }, + "password": { + "description": "新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + }, + "password_confirmation": { + "description": "確認新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "修改成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "密碼修改成功" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "目前密碼錯誤", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "目前密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/register/admin": { + "post": { + "tags": [ + "管理員" + ], + "summary": "管理員註冊", + "description": "建立新的管理員帳號", + "operationId": "registerAdmin", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "name", + "email", + "password", + "password_confirmation" + ], + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "張管理" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "admin@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "password_confirmation": { + "description": "確認密碼", + "type": "string", + "format": "password", + "example": "password123" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0912345678" + }, + "position": { + "description": "職位", + "type": "string", + "example": "系統管理員" + }, + "department": { + "description": "部門", + "type": "string", + "example": "IT部門" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "201": { + "description": "管理員註冊成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "管理員註冊成功" + }, + "data": { + "properties": { + "user": { + "$ref": "#/components/schemas/User" + }, + "token": { + "type": "string", + "example": "1|abcdef1234567890" + }, + "token_type": { + "type": "string", + "example": "Bearer" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/login/admin": { + "post": { + "tags": [ + "管理員" + ], + "summary": "管理員登入", + "description": "管理員帳號登入系統", + "operationId": "loginAdmin", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "email", + "password" + ], + "properties": { + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "admin@example.com" + }, + "password": { + "description": "密碼", + "type": "string", + "format": "password", + "example": "password123" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "登入成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "data": { + "properties": { + "id": { + "type": "integer", + "example": 11 + }, + "name": { + "type": "string", + "example": "測試管理員" + }, + "email": { + "type": "string", + "example": "test_admin@example.com" + }, + "email_verified_at": { + "type": "string", + "example": null, + "nullable": true + }, + "phone": { + "type": "string", + "example": "0912345678" + }, + "role": { + "type": "string", + "example": "admin" + }, + "is_active": { + "type": "integer", + "example": 1 + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "adminProfile": { + "properties": { + "id": { + "type": "integer", + "example": 5 + }, + "user_id": { + "type": "integer", + "example": 11 + }, + "birthday": { + "type": "string", + "example": "1990-01-01T00:00:00.000000Z" + }, + "gender": { + "type": "string", + "example": "male" + }, + "address": { + "type": "string", + "example": null, + "nullable": true + }, + "emergency_contact": { + "type": "string", + "example": null, + "nullable": true + }, + "emergency_phone": { + "type": "string", + "example": null, + "nullable": true + }, + "created_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + }, + "updated_at": { + "type": "string", + "example": "2025-05-08T17:19:22.000000Z" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "身份驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "電子郵件或密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "帳號已被停用", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "帳號已被停用" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + } + } + }, + "/logout/admin": { + "post": { + "tags": [ + "管理員" + ], + "summary": "管理員登出", + "description": "管理員登出系統並撤銷當前令牌", + "operationId": "logoutAdmin", + "responses": { + "200": { + "description": "登出成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "管理員登出成功" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/profile/admin": { + "get": { + "tags": [ + "管理員" + ], + "summary": "取得管理員個人資料", + "description": "取得當前登入管理員的個人資料", + "operationId": "adminProfile", + "responses": { + "200": { + "description": "取得資料成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "data": { + "$ref": "#/components/schemas/User" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + }, + "put": { + "tags": [ + "管理員" + ], + "summary": "更新管理員個人資料", + "description": "更新當前登入管理員的個人資料", + "operationId": "updateAdminProfile", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "properties": { + "name": { + "description": "使用者姓名", + "type": "string", + "example": "張總管" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "newadmin@example.com" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0987654321" + }, + "position": { + "description": "職位", + "type": "string", + "example": "資深系統管理員" + }, + "department": { + "description": "部門", + "type": "string", + "example": "系統維護部" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "更新成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "管理員資料已更新" + }, + "data": { + "$ref": "#/components/schemas/User" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + }, + "/password/admin": { + "post": { + "tags": [ + "管理員" + ], + "summary": "修改管理員密碼", + "description": "修改當前登入管理員的密碼", + "operationId": "changeAdminPassword", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "required": [ + "current_password", + "password", + "password_confirmation" + ], + "properties": { + "current_password": { + "description": "目前密碼", + "type": "string", + "format": "password", + "example": "oldpassword" + }, + "password": { + "description": "新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + }, + "password_confirmation": { + "description": "確認新密碼", + "type": "string", + "format": "password", + "example": "newpassword" + } + }, + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "修改成功", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": true + }, + "message": { + "type": "string", + "example": "密碼修改成功" + } + }, + "type": "object" + } + } + } + }, + "401": { + "description": "目前密碼錯誤", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "目前密碼錯誤" + } + }, + "type": "object" + } + } + } + }, + "403": { + "description": "無權限存取", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "無權限存取" + } + }, + "type": "object" + } + } + } + }, + "422": { + "description": "驗證失敗", + "content": { + "application/json": { + "schema": { + "properties": { + "status": { + "type": "boolean", + "example": false + }, + "message": { + "type": "string", + "example": "驗證失敗" + }, + "errors": { + "type": "object" + } + }, + "type": "object" + } + } + } + } + }, + "security": [ + { + "bearerAuth": [] + } + ] + } + } + }, + "components": { + "schemas": { + "AdminProfile": { + "title": "管理員個人資料", + "description": "管理員的詳細個人資料", + "properties": { + "id": { + "description": "資料ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "user_id": { + "description": "關聯的使用者ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "position": { + "description": "職位", + "type": "string", + "example": "系統管理員" + }, + "department": { + "description": "部門", + "type": "string", + "example": "IT部門" + }, + "permissions": { + "description": "權限列表", + "type": "array", + "items": { + "type": "string", + "example": "manage_users" + } + }, + "created_at": { + "description": "創建時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "description": "更新時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + }, + "CoachProfile": { + "title": "教練個人資料", + "description": "教練的詳細個人資料", + "properties": { + "id": { + "description": "資料ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "user_id": { + "description": "關聯的使用者ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "bio": { + "description": "個人簡介", + "type": "string", + "example": "專業潛水教練,擁有10年教學經驗" + }, + "expertise": { + "description": "專長領域", + "type": "string", + "example": "自由潛水,水肺潛水" + }, + "certification": { + "description": "證照資訊", + "type": "string", + "example": "PADI專業潛水教練" + }, + "experience": { + "description": "教學經驗", + "type": "string", + "example": "10年教學經驗,帶領超過500名學員" + }, + "rating": { + "description": "評分", + "type": "number", + "format": "float", + "example": 4.8 + }, + "availability": { + "description": "可授課時間", + "type": "string", + "example": "週一至週五 09:00-18:00" + }, + "created_at": { + "description": "創建時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "description": "更新時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + }, + "MemberProfile": { + "title": "會員個人資料", + "description": "會員的詳細個人資料", + "properties": { + "id": { + "description": "資料ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "user_id": { + "description": "關聯的使用者ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "birthday": { + "description": "生日", + "type": "string", + "format": "date", + "example": "1990-01-01" + }, + "gender": { + "description": "性別", + "type": "string", + "enum": [ + "male", + "female", + "other" + ], + "example": "male" + }, + "address": { + "description": "地址", + "type": "string", + "example": "台北市信義區某街123號" + }, + "emergency_contact": { + "description": "緊急聯絡人", + "type": "string", + "example": "王大明" + }, + "emergency_phone": { + "description": "緊急聯絡電話", + "type": "string", + "example": "0987654321" + }, + "created_at": { + "description": "創建時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "description": "更新時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + }, + "ProviderProfile": { + "title": "潛水業者資料", + "description": "潛水業者的詳細資料", + "properties": { + "id": { + "description": "資料ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "user_id": { + "description": "關聯的使用者ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "business_name": { + "description": "業者名稱", + "type": "string", + "example": "藍海潛水中心" + }, + "business_license": { + "description": "營業執照號碼", + "type": "string", + "example": "A123456789" + }, + "description": { + "description": "業者描述", + "type": "string", + "example": "專業潛水中心,提供各種潛水課程和裝備租賃服務" + }, + "contact_person": { + "description": "聯絡人", + "type": "string", + "example": "張三" + }, + "contact_phone": { + "description": "聯絡電話", + "type": "string", + "example": "0912345678" + }, + "contact_email": { + "description": "聯絡電子郵件", + "type": "string", + "example": "contact@bluedive.com" + }, + "address": { + "description": "營業地址", + "type": "string", + "example": "台灣屏東縣恆春鎮XXX路123號" + }, + "dive_sites": { + "description": "提供的潛點", + "type": "string", + "example": "墾丁,綠島,蘭嶼" + }, + "services": { + "description": "提供的服務", + "type": "string", + "example": "體驗潛水,初級潛水課程,進階潛水課程,裝備租賃" + }, + "certifications": { + "description": "業者相關認證", + "type": "string", + "example": "PADI五星級潛水中心,SSI認證中心" + }, + "facilities": { + "description": "設施", + "type": "string", + "example": "空氣填充站,沖洗區,更衣室,休息區" + }, + "business_hours": { + "description": "營業時間", + "type": "string", + "example": "週一至週五 09:00-18:00,週六日 08:00-19:00" + }, + "is_verified": { + "description": "是否通過平台驗證", + "type": "boolean", + "example": true + }, + "rating": { + "description": "評分", + "type": "number", + "format": "float", + "example": 4.8 + }, + "website": { + "description": "官方網站", + "type": "string", + "example": "https://www.bluedive.com" + }, + "social_media": { + "description": "社群媒體連結", + "type": "string", + "example": "https://www.facebook.com/bluedive" + }, + "logo_url": { + "description": "業者標誌URL", + "type": "string", + "example": "https://example.com/logo.png" + }, + "banner_url": { + "description": "業者橫幅URL", + "type": "string", + "example": "https://example.com/banner.png" + }, + "is_active": { + "description": "是否啟用", + "type": "boolean", + "example": true + }, + "created_at": { + "description": "創建時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "description": "更新時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + } + }, + "type": "object" + }, + "User": { + "title": "使用者", + "description": "使用者資料模型", + "properties": { + "id": { + "description": "使用者ID", + "type": "integer", + "format": "int64", + "example": 1 + }, + "name": { + "description": "使用者姓名", + "type": "string", + "example": "王小明" + }, + "email": { + "description": "電子郵件", + "type": "string", + "format": "email", + "example": "user@example.com" + }, + "phone": { + "description": "電話號碼", + "type": "string", + "example": "0912345678" + }, + "role": { + "description": "角色", + "type": "string", + "enum": [ + "member", + "provider", + "admin" + ], + "example": "member" + }, + "is_active": { + "description": "是否啟用", + "type": "boolean", + "example": true + }, + "email_verified_at": { + "description": "電子郵件驗證時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "created_at": { + "description": "創建時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "updated_at": { + "description": "更新時間", + "type": "string", + "format": "date-time", + "example": "2023-01-01T00:00:00.000000Z" + }, + "memberProfile": { + "$ref": "#/components/schemas/MemberProfile" + }, + "providerProfile": { + "$ref": "#/components/schemas/ProviderProfile" + }, + "adminProfile": { + "$ref": "#/components/schemas/AdminProfile" + } + }, + "type": "object" + } + }, + "securitySchemes": { + "bearerAuth": { + "type": "http", + "bearerFormat": "JWT", + "scheme": "bearer" + } + } + }, + "tags": [ + { + "name": "會員", + "description": "會員相關操作" + }, + { + "name": "服務提供者", + "description": "服務提供者相關操作" + }, + { + "name": "管理員", + "description": "管理員相關操作" + } + ] +} \ No newline at end of file