README、ドキュメントを更新

This commit is contained in:
2026-03-25 10:37:06 +09:00
parent 2a4fac79b1
commit aaaecbfab4
3 changed files with 401 additions and 246 deletions

View File

@@ -40,7 +40,12 @@ Authorization: Bearer hm_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
| メソッド | パス | 説明 |
|----------|------|------|
| GET | `/api/v1/assignments` | 課題一覧取得 |
| GET | `/api/v1/assignments` | 課題一覧取得(フィルタ・ページネーション対応) |
| GET | `/api/v1/assignments/pending` | 未完了課題一覧取得 |
| GET | `/api/v1/assignments/completed` | 完了済み課題一覧取得 |
| GET | `/api/v1/assignments/overdue` | 期限切れ課題一覧取得 |
| GET | `/api/v1/assignments/due-today` | 本日期限の課題一覧取得 |
| GET | `/api/v1/assignments/due-this-week` | 今週期限の課題一覧取得 |
| GET | `/api/v1/assignments/:id` | 課題詳細取得 |
| POST | `/api/v1/assignments` | 課題作成 |
| PUT | `/api/v1/assignments/:id` | 課題更新 |
@@ -64,7 +69,9 @@ GET /api/v1/assignments
| パラメータ | 型 | 説明 |
|------------|------|------|
| `filter` | string | フィルタ: `pending`, `completed`, `overdue` (省略時: 全件) |
| `filter` | string | フィルタ: `pending`, `completed`, `overdue`省略時: 全件 |
| `page` | integer | ページ番号(デフォルト: `1` |
| `page_size` | integer | 1ページあたりの件数デフォルト: `20`、最大: `100` |
### レスポンス
@@ -79,13 +86,18 @@ GET /api/v1/assignments
"title": "数学レポート",
"description": "第5章の練習問題",
"subject": "数学",
"priority": "medium",
"due_date": "2025-01-15T23:59:00+09:00",
"is_completed": false,
"created_at": "2025-01-10T10:00:00+09:00",
"updated_at": "2025-01-10T10:00:00+09:00"
}
],
"count": 1
"count": 1,
"total_count": 15,
"total_pages": 1,
"current_page": 1,
"page_size": 20
}
```
@@ -95,11 +107,43 @@ GET /api/v1/assignments
# 全件取得
curl -H "Authorization: Bearer hm_xxx" http://localhost:8080/api/v1/assignments
# 未完了のみ取得
curl -H "Authorization: Bearer hm_xxx" http://localhost:8080/api/v1/assignments?filter=pending
# 未完了のみ(ページネーション付き)
curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/assignments?filter=pending&page=1&page_size=10"
# 期限切れのみ取得
curl -H "Authorization: Bearer hm_xxx" http://localhost:8080/api/v1/assignments?filter=overdue
# 期限切れのみ
curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/assignments?filter=overdue"
```
---
## 絞り込み済み課題一覧取得
専用エンドポイントでも同等の絞り込みができます(`pending` / `completed` / `overdue` はページネーション対応)。
```
GET /api/v1/assignments/pending
GET /api/v1/assignments/completed
GET /api/v1/assignments/overdue
GET /api/v1/assignments/due-today
GET /api/v1/assignments/due-this-week
```
### クエリパラメータpending / completed / overdue のみ)
| パラメータ | 型 | 説明 |
|------------|------|------|
| `page` | integer | ページ番号(デフォルト: `1` |
| `page_size` | integer | 1ページあたりの件数デフォルト: `20`、最大: `100` |
### レスポンス
`due-today` / `due-this-week``count` のみ返します(ページネーションなし)。その他は `GET /api/v1/assignments` と同形式です。
### 例
```bash
curl -H "Authorization: Bearer hm_xxx" http://localhost:8080/api/v1/assignments/due-today
curl -H "Authorization: Bearer hm_xxx" http://localhost:8080/api/v1/assignments/due-this-week
```
---
@@ -127,6 +171,7 @@ GET /api/v1/assignments/:id
"title": "数学レポート",
"description": "第5章の練習問題",
"subject": "数学",
"priority": "medium",
"due_date": "2025-01-15T23:59:00+09:00",
"is_completed": false,
"created_at": "2025-01-10T10:00:00+09:00",
@@ -163,29 +208,30 @@ POST /api/v1/assignments
| `title` | string | ✅ | 課題タイトル |
| `description` | string | | 説明 |
| `subject` | string | | 教科・科目 |
| `priority` | string | | 重要度: `low`, `medium`, `high`(デフォルト: `medium` |
| `due_date` | string | ✅ | 提出期限RFC3339 または `YYYY-MM-DDTHH:MM` または `YYYY-MM-DD` |
| `reminder_enabled` | boolean | | リマインダーを有効にするか(省略時: false |
| `reminder_at` | string | | リマインダー設定時刻形式はdue_dateと同じ |
| `urgent_reminder_enabled` | boolean | | 期限切れ時の督促リマインダーを有効にするか(省略時: true |
| `recurrence` | object | | 繰り返し設定(下参照) |
| `reminder_enabled` | boolean | | リマインダーを有効にするか(デフォルト: `false` |
| `reminder_at` | string | | リマインダー設定時刻(形式は `due_date` と同じ) |
| `urgent_reminder_enabled` | boolean | | 督促リマインダーを有効にするか(デフォルト: `true` |
| `recurrence` | object | | 繰り返し設定(下参照) |
### Recurrence オブジェクト
| フィールド | 型 | 説明 |
|------------|------|------|
| `type` | string | 繰り返しタイプ (`daily`, `weekly`, `monthly`, または空文字で無効) |
| `interval` | integer | 間隔 (例: 1 = 毎週, 2 = 隔週) |
| `weekday` | integer | 週次の曜日 (0=日, 1=月, ..., 6=土) |
| `day` | integer | 月次の日付 (1-31) |
| `type` | string | 繰り返しタイプ: `daily`, `weekly`, `monthly`(空文字で繰り返しなし) |
| `interval` | integer | 繰り返し間隔(例: `1` = 毎週、`2` = 隔週 |
| `weekday` | integer | 週次の曜日`0`=日, `1`=月, ..., `6`=土 |
| `day` | integer | 月次の日付1-31 |
| `until` | object | 終了条件 |
#### Recurrence.Until オブジェクト
| フィールド | 型 | 説明 |
|------------|------|------|
| `type` | string | 終了タイプ (`never`, `count`, `date`) |
| `count` | integer | 回数指定時の終了回数 |
| `date` | string | 日付指定時の終了日 |
| `type` | string | 終了タイプ: `never`, `count`, `date` |
| `count` | integer | 終了回数`count` 指定時) |
| `date` | string | 終了日`date` 指定時) |
### リクエスト例
@@ -194,6 +240,7 @@ POST /api/v1/assignments
"title": "英語エッセイ",
"description": "テーマ自由、1000語以上",
"subject": "英語",
"priority": "high",
"due_date": "2025-01-20T17:00"
}
```
@@ -209,6 +256,7 @@ POST /api/v1/assignments
"title": "英語エッセイ",
"description": "テーマ自由、1000語以上",
"subject": "英語",
"priority": "high",
"due_date": "2025-01-20T17:00:00+09:00",
"is_completed": false,
"created_at": "2025-01-10T11:00:00+09:00",
@@ -216,11 +264,20 @@ POST /api/v1/assignments
}
```
繰り返し設定を含む場合は `recurring_assignment` を返します:
```json
{
"message": "Recurring assignment created",
"recurring_assignment": { ... }
}
```
**400 Bad Request**
```json
{
"error": "Invalid input: title and due_date are required"
"error": "Invalid input: Key: 'title' Error:Field validation for 'title' failed on the 'required' tag"
}
```
@@ -230,7 +287,7 @@ POST /api/v1/assignments
curl -X POST \
-H "Authorization: Bearer hm_xxx" \
-H "Content-Type: application/json" \
-d '{"title":"英語エッセイ","due_date":"2025-01-20"}' \
-d '{"title":"英語エッセイ","subject":"英語","due_date":"2025-01-20"}' \
http://localhost:8080/api/v1/assignments
```
@@ -257,6 +314,7 @@ PUT /api/v1/assignments/:id
| `title` | string | 課題タイトル |
| `description` | string | 説明 |
| `subject` | string | 教科・科目 |
| `priority` | string | 重要度: `low`, `medium`, `high` |
| `due_date` | string | 提出期限 |
| `reminder_enabled` | boolean | リマインダー有効/無効 |
| `reminder_at` | string | リマインダー時刻 |
@@ -273,21 +331,7 @@ PUT /api/v1/assignments/:id
### レスポンス
**200 OK**
```json
{
"id": 2,
"user_id": 1,
"title": "英語エッセイ(修正版)",
"description": "テーマ自由、1000語以上",
"subject": "英語",
"due_date": "2025-01-25T17:00:00+09:00",
"is_completed": false,
"created_at": "2025-01-10T11:00:00+09:00",
"updated_at": "2025-01-10T12:00:00+09:00"
}
```
**200 OK** — 更新後の課題オブジェクト
**404 Not Found**
@@ -332,25 +376,33 @@ DELETE /api/v1/assignments/:id
**200 OK**
```json
{
"message": "Assignment deleted"
}
{ "message": "Assignment deleted" }
```
繰り返し設定も削除した場合:
```json
{ "message": "Assignment and recurring settings deleted" }
```
**404 Not Found**
```json
{
"error": "Assignment not found"
}
{ "error": "Assignment not found" }
```
### 例
```bash
# 課題のみ削除
curl -X DELETE \
-H "Authorization: Bearer hm_xxx" \
http://localhost:8080/api/v1/assignments/2
# 課題と繰り返し設定をまとめて削除
curl -X DELETE \
-H "Authorization: Bearer hm_xxx" \
"http://localhost:8080/api/v1/assignments/2?delete_recurring=true"
```
---
@@ -380,6 +432,7 @@ PATCH /api/v1/assignments/:id/toggle
"title": "数学レポート",
"description": "第5章の練習問題",
"subject": "数学",
"priority": "medium",
"due_date": "2025-01-15T23:59:00+09:00",
"is_completed": true,
"completed_at": "2025-01-12T14:30:00+09:00",
@@ -391,9 +444,7 @@ PATCH /api/v1/assignments/:id/toggle
**404 Not Found**
```json
{
"error": "Assignment not found"
}
{ "error": "Assignment not found" }
```
### 例
@@ -408,7 +459,7 @@ curl -X PATCH \
## 統計情報取得
ユーザーの課題統計を取得します。科目、日付範囲でフィルタリング可能です。
ユーザーの課題統計を取得します。
```
GET /api/v1/statistics
@@ -419,8 +470,9 @@ GET /api/v1/statistics
| パラメータ | 型 | 説明 |
|------------|------|------|
| `subject` | string | 科目で絞り込み(省略時: 全科目) |
| `from` | string | 課題登録日の開始日YYYY-MM-DD形式 |
| `to` | string | 課題登録日の終了日YYYY-MM-DD形式 |
| `from` | string | 課題登録日の開始日(`YYYY-MM-DD` |
| `to` | string | 課題登録日の終了日(`YYYY-MM-DD` |
| `include_archived` | boolean | アーカイブ済み課題を含む(デフォルト: `false` |
### レスポンス
@@ -446,36 +498,11 @@ GET /api/v1/statistics
"pending": 2,
"overdue": 1,
"on_time_completion_rate": 91.7
},
{
"subject": "英語",
"total": 10,
"completed": 8,
"pending": 2,
"overdue": 0,
"on_time_completion_rate": 87.5
}
]
}
```
### 科目別統計 (特定科目のみ)
```json
{
"total_assignments": 15,
"completed_assignments": 12,
"pending_assignments": 2,
"overdue_assignments": 1,
"on_time_completion_rate": 91.7,
"filter": {
"subject": "数学",
"from": null,
"to": null
}
}
```
### 例
```bash
@@ -487,9 +514,175 @@ curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/statistics?
# 日付範囲で絞り込み
curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/statistics?from=2025-01-01&to=2025-03-31"
```
# 科目と日付範囲の組み合わせ
curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/statistics?subject=数学&from=2025-01-01&to=2025-03-31"
---
## 繰り返し設定一覧取得
```
GET /api/v1/recurring
```
### レスポンス
**200 OK**
```json
{
"recurring_assignments": [
{
"id": 1,
"user_id": 1,
"title": "週次ミーティング",
"subject": "その他",
"priority": "medium",
"recurrence_type": "weekly",
"recurrence_interval": 1,
"recurrence_weekday": 1,
"due_time": "23:59",
"end_type": "never",
"is_active": true,
"created_at": "2025-01-01T00:00:00+09:00",
"updated_at": "2025-01-01T00:00:00+09:00"
}
],
"count": 1
}
```
---
## 繰り返し設定詳細取得
```
GET /api/v1/recurring/:id
```
### パスパラメータ
| パラメータ | 型 | 説明 |
|------------|------|------|
| `id` | integer | 繰り返し設定ID |
### レスポンス
**200 OK** — 繰り返し設定オブジェクト(一覧と同形式)
**404 Not Found**
```json
{ "error": "Recurring assignment not found" }
```
---
## 繰り返し設定更新
```
PUT /api/v1/recurring/:id
```
### パスパラメータ
| パラメータ | 型 | 説明 |
|------------|------|------|
| `id` | integer | 繰り返し設定ID |
### リクエストボディ
すべてのフィールドはオプションです。省略されたフィールドは既存の値を維持します。
| フィールド | 型 | 説明 |
|------------|------|------|
| `title` | string | タイトル |
| `description` | string | 説明 |
| `subject` | string | 教科・科目 |
| `priority` | string | 重要度: `low`, `medium`, `high` |
| `recurrence_type` | string | 繰り返しタイプ: `daily`, `weekly`, `monthly` |
| `recurrence_interval` | integer | 繰り返し間隔 |
| `recurrence_weekday` | integer | 週次の曜日0-6 |
| `recurrence_day` | integer | 月次の日付1-31 |
| `due_time` | string | 締切時刻(`HH:MM` |
| `end_type` | string | 終了タイプ: `never`, `count`, `date` |
| `end_count` | integer | 終了回数 |
| `end_date` | string | 終了日(`YYYY-MM-DD` |
| `is_active` | boolean | `false` で停止、`true` で再開 |
| `reminder_enabled` | boolean | リマインダー有効/無効 |
| `reminder_offset` | integer | リマインダーのオフセット(分) |
| `urgent_reminder_enabled` | boolean | 督促リマインダー有効/無効 |
| `edit_behavior` | string | 編集範囲: `this_only`, `this_and_future`, `all`(デフォルト: `this_only` |
### リクエスト例(一時停止)
```json
{
"is_active": false
}
```
### レスポンス
**200 OK** — 更新後の繰り返し設定オブジェクト
**404 Not Found**
```json
{ "error": "Recurring assignment not found" }
```
### 例
```bash
# 一時停止
curl -X PUT \
-H "Authorization: Bearer hm_xxx" \
-H "Content-Type: application/json" \
-d '{"is_active": false}' \
http://localhost:8080/api/v1/recurring/1
# タイトルと締切時刻を変更
curl -X PUT \
-H "Authorization: Bearer hm_xxx" \
-H "Content-Type: application/json" \
-d '{"title":"更新済みタスク","due_time":"22:00"}' \
http://localhost:8080/api/v1/recurring/1
```
---
## 繰り返し設定削除
```
DELETE /api/v1/recurring/:id
```
### パスパラメータ
| パラメータ | 型 | 説明 |
|------------|------|------|
| `id` | integer | 繰り返し設定ID |
### レスポンス
**200 OK**
```json
{ "message": "Recurring assignment deleted" }
```
**404 Not Found**
```json
{ "error": "Recurring assignment not found or failed to delete" }
```
### 例
```bash
curl -X DELETE \
-H "Authorization: Bearer hm_xxx" \
http://localhost:8080/api/v1/recurring/1
```
---
@@ -511,6 +704,7 @@ curl -H "Authorization: Bearer hm_xxx" "http://localhost:8080/api/v1/statistics?
| 400 Bad Request | リクエストの形式が不正 |
| 401 Unauthorized | 認証エラー |
| 404 Not Found | リソースが見つからない |
| 429 Too Many Requests | レート制限超過 |
| 500 Internal Server Error | サーバー内部エラー |
---
@@ -521,7 +715,7 @@ APIは以下の日付形式を受け付けます優先度順
1. **RFC3339**: `2025-01-15T23:59:00+09:00`
2. **日時形式**: `2025-01-15T23:59`
3. **日付のみ**: `2025-01-15`時刻は23:59に設定
3. **日付のみ**: `2025-01-15`(時刻は `23:59` に設定)
レスポンスの日付はすべてRFC3339形式で返されます。
@@ -542,83 +736,3 @@ APIは以下の日付形式を受け付けます優先度順
```
設定ファイル (`config.ini`) または環境変数で制限値を変更可能です。
---
## 繰り返し設定一覧取得
```
GET /api/v1/recurring
```
### レスポンス
**200 OK**
```json
{
"recurring_assignments": [
{
"id": 1,
"user_id": 1,
"title": "週次ミーティング",
"recurrence_type": "weekly",
"interval": 1,
"weekday": 1,
"is_active": true
}
],
"count": 1
}
```
---
## 繰り返し設定詳細取得
```
GET /api/v1/recurring/:id
```
### レスポンス
**200 OK**
---
## 繰り返し設定更新
```
PUT /api/v1/recurring/:id
```
### リクエストボディ
各フィールドはオプション。省略時は更新なし。
| フィールド | 型 | 説明 |
|------------|------|------|
| `title` | string | タイトル |
| `is_active` | boolean | `false` で停止、`true` で再開 |
| `recurrence_type` | string | `daily`, `weekly`, `monthly` |
| ... | ... | その他の設定フィールド |
### リクエスト例(停止)
```json
{
"is_active": false
}
```
---
## 繰り返し設定削除
```
DELETE /api/v1/recurring/:id
```
### レスポンス
**200 OK**