Compare commits

...

3 Commits

Author SHA1 Message Date
a620906209 b02a18d762 test:編寫Postman API測試文件 2025-05-23 18:31:33 +08:00
a620906209 0a0d335304 docs:移除coach swagger註解 2025-05-12 02:43:37 +08:00
a620906209 6fef9e8c37 Update README.md
Swagger API Doc
2025-05-12 02:37:02 +08:00
5 changed files with 509 additions and 148 deletions
@@ -0,0 +1,501 @@
{
"info": {
"name": "CFDivePlatform API Tests",
"description": "CFDivePlatform API 測試集合 - 包含會員、服務提供者、管理員等完整測試案例",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "基礎測試",
"item": [
{
"name": "Ping Test",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "http://localhost:8080/api/ping",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "ping"]
}
}
},
{
"name": "Test POST",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"測試用戶\",\n \"value\": \"123\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/testpost",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "testpost"]
}
}
}
]
},
{
"name": "會員認證",
"item": [
{
"name": "會員註冊",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"測試會員\",\n \"email\": \"member@test.com\",\n \"password\": \"password123\",\n \"password_confirmation\": \"password123\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/member/register",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "register"]
}
}
},
{
"name": "會員登入",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"member@test.com\",\n \"password\": \"password123\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/member/login",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "login"]
}
}
},
{
"name": "取得會員資料",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{member_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/member/profile",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "profile"]
}
}
}
]
},
{
"name": "會員專屬 API",
"item": [
{
"name": "會員登出",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{member_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/member/logout",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "logout"]
}
}
},
{
"name": "更新會員個人資料",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{member_token}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"更新後的會員名稱\",\n \"phone\": \"0912345678\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/member/profile",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "profile"]
}
}
},
{
"name": "修改會員密碼",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{member_token}}"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"current_password\": \"password123\",\n \"new_password\": \"newpassword123\",\n \"new_password_confirmation\": \"newpassword123\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/member/change-password",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "member", "change-password"]
}
}
}
]
},
{
"name": "服務提供者認證",
"item": [
{
"name": "服務提供者註冊",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"測試教練\",\n \"email\": \"{{test_provider_email}}\",\n \"password\": \"{{test_password}}\",\n \"password_confirmation\": \"{{test_password}}\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/provider/register",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "provider", "register"]
}
}
},
{
"name": "服務提供者登入",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"{{test_provider_email}}\",\n \"password\": \"{{test_password}}\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/provider/login",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "provider", "login"]
}
}
}
]
},
{
"name": "服務提供者專屬 API",
"item": [
{
"name": "服務提供者登出",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{provider_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/provider/logout",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "provider", "logout"]
}
}
},
{
"name": "取得服務提供者資料",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{provider_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/provider/profile",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "provider", "profile"]
}
}
}
]
},
{
"name": "管理員認證",
"item": [
{
"name": "管理員註冊",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"測試管理員\",\n \"email\": \"{{test_admin_email}}\",\n \"password\": \"{{test_password}}\",\n \"password_confirmation\": \"{{test_password}}\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/admin/register",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "admin", "register"]
}
}
},
{
"name": "管理員登入",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"{{test_admin_email}}\",\n \"password\": \"{{test_password}}\"\n}"
},
"url": {
"raw": "http://localhost:8080/api/admin/login",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "admin", "login"]
}
}
}
]
},
{
"name": "管理員專屬 API",
"item": [
{
"name": "查詢會員資料",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{admin_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/admin/check-member/1",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "admin", "check-member", "1"],
"variable": [
{
"key": "id",
"value": "1"
}
]
}
}
},
{
"name": "查詢服務提供者資料",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{admin_token}}"
}
],
"url": {
"raw": "http://localhost:8080/api/admin/check-provider/1",
"protocol": "http",
"host": ["localhost"],
"port": "8080",
"path": ["api", "admin", "check-provider", "1"],
"variable": [
{
"key": "id",
"value": "1"
}
]
}
}
}
]
}
],
"variable": [
{
"key": "base_url",
"value": "http://localhost:8080/api"
},
{
"key": "member_token",
"value": "",
"description": "會員登入後設定"
},
{
"key": "provider_token",
"value": "",
"description": "服務提供者登入後設定"
},
{
"key": "admin_token",
"value": "",
"description": "管理員登入後設定"
},
{
"key": "test_member_email",
"value": "member@test.com"
},
{
"key": "test_provider_email",
"value": "provider@test.com"
},
{
"key": "test_admin_email",
"value": "admin@test.com"
},
{
"key": "test_password",
"value": "password123"
}
]
}
+3 -65
View File
@@ -1,66 +1,4 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
![image](https://github.com/user-attachments/assets/332bf381-8faa-441f-8843-bff2c1fbde7a)
![image](https://github.com/user-attachments/assets/f0a765f5-5386-467e-80b8-4a5ef8ef0bcf)
![image](https://github.com/user-attachments/assets/5d6ad6ee-f100-4d45-9200-d61ce76ca7c4)
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
+1 -17
View File
@@ -4,23 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @OA\Schema(
* schema="CoachProfile",
* title="教練個人資料",
* description="教練的詳細個人資料",
* @OA\Property(property="id", type="integer", format="int64", example=1, description="資料ID"),
* @OA\Property(property="user_id", type="integer", format="int64", example=1, description="關聯的使用者ID"),
* @OA\Property(property="bio", type="string", example="專業潛水教練,擁有10年教學經驗", description="個人簡介"),
* @OA\Property(property="expertise", type="string", example="自由潛水,水肺潛水", description="專長領域"),
* @OA\Property(property="certification", type="string", example="PADI專業潛水教練", description="證照資訊"),
* @OA\Property(property="experience", type="string", example="10年教學經驗,帶領超過500名學員", description="教學經驗"),
* @OA\Property(property="rating", type="number", format="float", example=4.8, description="評分"),
* @OA\Property(property="availability", type="string", example="週一至週五 09:00-18:00", description="可授課時間"),
* @OA\Property(property="created_at", type="string", format="date-time", example="2023-01-01T00:00:00.000000Z", description="創建時間"),
* @OA\Property(property="updated_at", type="string", format="date-time", example="2023-01-01T00:00:00.000000Z", description="更新時間")
* )
*/
// 該模型已棄用,請使用ProviderProfile模型
class CoachProfile extends Model
{
/**
+2 -2
View File
@@ -7,8 +7,8 @@ use Illuminate\Database\Eloquent\Model;
/**
* @OA\Schema(
* schema="ProviderProfile",
* title="潛水業者資料",
* description="潛水業者的詳細資料",
* title="服務提供者資料",
* description="服務提供者的詳細資料",
* @OA\Property(property="id", type="integer", format="int64", example=1, description="資料ID"),
* @OA\Property(property="user_id", type="integer", format="int64", example=1, description="關聯的使用者ID"),
* @OA\Property(property="business_name", type="string", example="藍海潛水中心", description="業者名稱"),
+2 -64
View File
@@ -2618,68 +2618,6 @@
},
"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": "會員的詳細個人資料",
@@ -2743,8 +2681,8 @@
"type": "object"
},
"ProviderProfile": {
"title": "潛水業者資料",
"description": "潛水業者的詳細資料",
"title": "服務提供者資料",
"description": "服務提供者的詳細資料",
"properties": {
"id": {
"description": "資料ID",