## 主畫面
:::spoiler Logout
- 登出( hover 帳號 ):
1. url:/api/logout
2. method:POST
3. content-type:application/json
4. request:
```!python
{
"Authorization": "Bearer your_access_token",
}
```
5. reponse:
1. success:(status code 200)
```!python
{
"message": "Logout success",
}
```
2. error:(status code 401 Unauthorized)
```!python
{
"error": "Unauthorized",
}
```
6. 登出前,確保使用者已經登入系統並獲取了有效的訪問令牌
:::
:::spoiler Create Task
- Create Task:
1. url:/api/tasks
2. method:POST
3. content-type:application/json
4. request:Authorization,五種資料
```!python
{
"Authorization": "Bearer your_access_token",
}
{
"username": "max111880",
"title": "task_title",
"description": "Task description",
"priority": "High",
"status": "todo",
"start_time": "datetime",
"deadline": "datetime",
}
```
5. reponse:
1. success:(status code 200)
```!python
{
"message": "Task created successfully",
}
```
2. error:(status code 400 or 401 )
```!python
{
"error": "Invalid input data",
}
or
{
"error": "Unauthorized",(驗證不過)
}
```
:::
:::spoiler Filter
- Filter by
1. Priority:
2. All:
3. Done:
4. Today:
1. url:/api/tasks/filter/\<filter-method>
2. method:GET
3. filter-method:today、priority、done、all
4. request:Authorization,排序方式
```!python
{
"Authorization": "Bearer your_access_token",
}
```
5. reponse:
1. success:(status code 200)
```!python
{
"tasks": [
{
"id": 1,
"title": "task_title",
"description": "Task description",
"priority": "High",
"status": "todo",
"start_time": "datetime",
"deadline": "datetime",
},
// ...
]
}
```
2. error:(status code 400 or 401 )
```!python
{
"error": "Unauthorized",(驗證不過)
}
or
{
"error": "Method not supported",
}
```
:::
:::spoiler Edit
- Edit:
1. URL:/api/tasks/:task_id
2. method:PUT
3. request:Authorization,所有資訊
```!python
{
"Authorization": "Bearer your_access_token",
}
{
{
"id": 1,
"title": "task_title",
"description": "Task description",
"priority": "High",
"status": "todo",
"start_time": "datetime",
"deadline": "datetime",
}
}
```
4. reponse:
1. success:(status code 200)
```!python
{
"message": "Task Update successfully"
}
```
2. error:(status code 401 or 404)
```!python
{
"error": "Unauthorized",(驗證不過)
}
or
{
"error": "Task not found"
}
```
:::
:::spoiler Delete
- Delete:
1. URL:/api/tasks/:task_id
2. method:DELETE
3. request:Authorization,所有資訊
```!python
{
"Authorization": "Bearer your_access_token",
}
```
4. reponse:
1. success:(status code 200)
```!python
{
"message": "Task deleted successfully"
}
```
2. error:(status code 401 or 404)
```!python
{
"error": "Unauthorized",(驗證不過)
}
or
{
"error": "Task not found"
}
```
:::
## 註冊畫面
:::spoiler 註冊畫面
1. 註冊:
1. url:/aip/register
2. content-type:appliction/json
3. method:POST
4. request:
```python
{
"username": "Max111880",
"password": "test1234",
"email": "max111880@gmail.com",
}
```
5. response:
1. success:(status code 200)
```python
{
"message": "Registration successful",
}
```
2. error:(status code )
```python
{
"message": "Registration failed",
}
```
2. 跳轉登入:由 React 自行跳轉
:::
## 登入畫面
:::spoiler 登入畫面
- login:
1. url:api/login
2. method:POST
3. content-type:application/json
4. request:
```python
{
"username": "username",
"password": "password",
}
```
5. response:
1. success:( status code 200 )
```python
Content-Type: application/json
{
"message": "Login successful",
"token": "your_access_token",
}
```
2. error:( status code 401 )
```python
Content-Type: application/json
{
"message": "login failed",
}
```
- 跳轉註冊、跳轉重設密碼:
- 由 React 前段自行跳轉畫面
:::
## 重設密碼畫面
:::spoiler
- 重設密碼:
1. url:/api/reset-password
2. method:POST
3. content-type:application/json
4. request:
1. 前端自行驗證兩次密碼是否相同
```python
{
"Email": "Email",
"password": "password",
}
```
5. reponse:
1. success:(status code 200)
```python
{
"message": "Reset success",
"password": "password",
}
```
2. error:(status code 400)
```python
{
"message": "Reset failed",
}
```
2. 跳轉登入:前端 React 自行跳轉
:::