taskdog-server 0.18.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taskdog_server-0.18.1/PKG-INFO +216 -0
- taskdog_server-0.18.1/README.md +187 -0
- taskdog_server-0.18.1/pyproject.toml +79 -0
- taskdog_server-0.18.1/setup.cfg +4 -0
- taskdog_server-0.18.1/src/taskdog_server/__init__.py +11 -0
- taskdog_server-0.18.1/src/taskdog_server/api/__init__.py +5 -0
- taskdog_server-0.18.1/src/taskdog_server/api/app.py +100 -0
- taskdog_server-0.18.1/src/taskdog_server/api/context.py +60 -0
- taskdog_server-0.18.1/src/taskdog_server/api/converters.py +138 -0
- taskdog_server-0.18.1/src/taskdog_server/api/dependencies.py +459 -0
- taskdog_server-0.18.1/src/taskdog_server/api/error_handlers.py +62 -0
- taskdog_server-0.18.1/src/taskdog_server/api/middleware.py +83 -0
- taskdog_server-0.18.1/src/taskdog_server/api/models/__init__.py +37 -0
- taskdog_server-0.18.1/src/taskdog_server/api/models/requests.py +180 -0
- taskdog_server-0.18.1/src/taskdog_server/api/models/responses.py +400 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/__init__.py +23 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/analytics.py +401 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/audit.py +148 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/bulk.py +174 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/lifecycle.py +184 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/notes.py +147 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/relationships.py +155 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/tags.py +56 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/tasks.py +412 -0
- taskdog_server-0.18.1/src/taskdog_server/api/routers/websocket.py +91 -0
- taskdog_server-0.18.1/src/taskdog_server/api/utils.py +54 -0
- taskdog_server-0.18.1/src/taskdog_server/api/validators.py +29 -0
- taskdog_server-0.18.1/src/taskdog_server/config/__init__.py +15 -0
- taskdog_server-0.18.1/src/taskdog_server/config/server_config_manager.py +111 -0
- taskdog_server-0.18.1/src/taskdog_server/infrastructure/__init__.py +1 -0
- taskdog_server-0.18.1/src/taskdog_server/infrastructure/logging/__init__.py +5 -0
- taskdog_server-0.18.1/src/taskdog_server/infrastructure/logging/config.py +60 -0
- taskdog_server-0.18.1/src/taskdog_server/infrastructure/logging/standard_logger.py +60 -0
- taskdog_server-0.18.1/src/taskdog_server/main.py +74 -0
- taskdog_server-0.18.1/src/taskdog_server/py.typed +0 -0
- taskdog_server-0.18.1/src/taskdog_server/websocket/__init__.py +6 -0
- taskdog_server-0.18.1/src/taskdog_server/websocket/broadcaster.py +214 -0
- taskdog_server-0.18.1/src/taskdog_server/websocket/connection_manager.py +106 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/PKG-INFO +216 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/SOURCES.txt +42 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/dependency_links.txt +1 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/entry_points.txt +2 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/requires.txt +12 -0
- taskdog_server-0.18.1/src/taskdog_server.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: taskdog-server
|
|
3
|
+
Version: 0.18.1
|
|
4
|
+
Summary: FastAPI server for Taskdog task management system
|
|
5
|
+
Author: Kohei Wada
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Kohei-Wada/taskdog
|
|
8
|
+
Project-URL: Repository, https://github.com/Kohei-Wada/taskdog
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Kohei-Wada/taskdog/issues
|
|
10
|
+
Keywords: task,management,api,fastapi
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: taskdog-core==0.18.1
|
|
19
|
+
Requires-Dist: fastapi>=0.115.0
|
|
20
|
+
Requires-Dist: uvicorn[standard]>=0.32.0
|
|
21
|
+
Requires-Dist: pydantic>=2.10.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-asyncio>=1.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: httpx>=0.27.0; extra == "dev"
|
|
27
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.7.0; extra == "dev"
|
|
29
|
+
|
|
30
|
+
# taskdog-server
|
|
31
|
+
|
|
32
|
+
FastAPI server for Taskdog task management system.
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
This package provides a REST API for all Taskdog functionality including:
|
|
37
|
+
|
|
38
|
+
- Task CRUD operations
|
|
39
|
+
- Task lifecycle management (start, complete, pause, cancel, reopen)
|
|
40
|
+
- Task relationships (dependencies, tags)
|
|
41
|
+
- Time tracking and logging
|
|
42
|
+
- Schedule optimization
|
|
43
|
+
- Statistics and analytics
|
|
44
|
+
- WebSocket real-time updates
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install taskdog-server
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For development:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install -e ".[dev]"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
Start the server:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
taskdog-server
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
With custom options:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
taskdog-server --host 0.0.0.0 --port 3000
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Development mode with auto-reload:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
taskdog-server --reload
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## API Documentation
|
|
79
|
+
|
|
80
|
+
Once the server is running, visit:
|
|
81
|
+
|
|
82
|
+
- Interactive API docs: http://localhost:8000/docs
|
|
83
|
+
- Alternative docs: http://localhost:8000/redoc
|
|
84
|
+
- Health check: http://localhost:8000/health
|
|
85
|
+
|
|
86
|
+
For complete API reference, see [docs/API.md](../../docs/API.md).
|
|
87
|
+
|
|
88
|
+
## Authentication
|
|
89
|
+
|
|
90
|
+
Configure API key authentication in `~/.config/taskdog/server.toml`:
|
|
91
|
+
|
|
92
|
+
```toml
|
|
93
|
+
[auth]
|
|
94
|
+
enabled = true
|
|
95
|
+
|
|
96
|
+
[[auth.api_keys]]
|
|
97
|
+
name = "my-client"
|
|
98
|
+
key = "your-secret-key"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Clients authenticate via `X-Api-Key` header:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
curl -H "X-Api-Key: your-secret-key" http://localhost:8000/api/v1/tasks/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
See [Authentication Documentation](../../docs/API.md#authentication) for details.
|
|
108
|
+
|
|
109
|
+
## WebSocket Real-time Updates
|
|
110
|
+
|
|
111
|
+
Connect to `/ws` for real-time task notifications:
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
const ws = new WebSocket('ws://localhost:8000/ws?token=your-api-key');
|
|
115
|
+
|
|
116
|
+
ws.onmessage = (event) => {
|
|
117
|
+
const data = JSON.parse(event.data);
|
|
118
|
+
console.log('Event:', data.type); // task_created, task_updated, etc.
|
|
119
|
+
};
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Event types:**
|
|
123
|
+
|
|
124
|
+
- `task_created` - New task created
|
|
125
|
+
- `task_updated` - Task fields updated
|
|
126
|
+
- `task_deleted` - Task deleted
|
|
127
|
+
- `task_status_changed` - Task status changed
|
|
128
|
+
- `schedule_optimized` - Schedule optimization completed
|
|
129
|
+
|
|
130
|
+
**Note:** WebSocket uses an in-memory connection manager, so the server always runs as a single process.
|
|
131
|
+
|
|
132
|
+
## Configuration
|
|
133
|
+
|
|
134
|
+
Server configuration: `~/.config/taskdog/server.toml`
|
|
135
|
+
|
|
136
|
+
```toml
|
|
137
|
+
[auth]
|
|
138
|
+
enabled = true
|
|
139
|
+
|
|
140
|
+
[[auth.api_keys]]
|
|
141
|
+
name = "my-client"
|
|
142
|
+
key = "your-secret-key"
|
|
143
|
+
|
|
144
|
+
[audit]
|
|
145
|
+
enabled = false
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Core configuration: `~/.config/taskdog/core.toml`
|
|
149
|
+
|
|
150
|
+
```toml
|
|
151
|
+
[region]
|
|
152
|
+
country = "JP"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
See [Configuration Guide](../../docs/CONFIGURATION.md) for all options.
|
|
156
|
+
|
|
157
|
+
## Architecture
|
|
158
|
+
|
|
159
|
+
The server uses:
|
|
160
|
+
|
|
161
|
+
- **FastAPI**: Modern, fast web framework
|
|
162
|
+
- **Pydantic**: Data validation with type hints
|
|
163
|
+
- **uvicorn**: ASGI server
|
|
164
|
+
- **taskdog-core**: Core business logic and infrastructure
|
|
165
|
+
|
|
166
|
+
### API Routers
|
|
167
|
+
|
|
168
|
+
- `tasks.py` - Task CRUD operations
|
|
169
|
+
- `lifecycle.py` - Task status changes
|
|
170
|
+
- `relationships.py` - Dependencies and tags
|
|
171
|
+
- `analytics.py` - Statistics and reporting
|
|
172
|
+
- `notes.py` - Markdown notes
|
|
173
|
+
- `websocket.py` - Real-time updates
|
|
174
|
+
|
|
175
|
+
### Dependency Injection
|
|
176
|
+
|
|
177
|
+
Controllers are injected via FastAPI dependencies:
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
CrudControllerDep = Annotated[TaskCrudController, Depends(get_crud_controller)]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Related Packages
|
|
184
|
+
|
|
185
|
+
- [taskdog-core](../taskdog-core/): Core business logic used by this package
|
|
186
|
+
- [taskdog-ui](../taskdog-ui/): CLI and TUI interfaces connecting to this server
|
|
187
|
+
- [taskdog-client](../taskdog-client/): HTTP client library for API access
|
|
188
|
+
- [taskdog-mcp](../taskdog-mcp/): MCP server for Claude Desktop integration
|
|
189
|
+
|
|
190
|
+
## Testing
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pytest tests/
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Deployment
|
|
197
|
+
|
|
198
|
+
### Systemd (Linux)
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
systemctl --user start taskdog-server
|
|
202
|
+
systemctl --user enable taskdog-server
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Docker
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
docker pull ghcr.io/kohei-wada/taskdog-server:main
|
|
209
|
+
docker run -d -p 8000:8000 -v taskdog-data:/data ghcr.io/kohei-wada/taskdog-server:main
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
See [contrib/README.md](../../contrib/README.md) for deployment details.
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# taskdog-server
|
|
2
|
+
|
|
3
|
+
FastAPI server for Taskdog task management system.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a REST API for all Taskdog functionality including:
|
|
8
|
+
|
|
9
|
+
- Task CRUD operations
|
|
10
|
+
- Task lifecycle management (start, complete, pause, cancel, reopen)
|
|
11
|
+
- Task relationships (dependencies, tags)
|
|
12
|
+
- Time tracking and logging
|
|
13
|
+
- Schedule optimization
|
|
14
|
+
- Statistics and analytics
|
|
15
|
+
- WebSocket real-time updates
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install taskdog-server
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For development:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Start the server:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
taskdog-server
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
With custom options:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
taskdog-server --host 0.0.0.0 --port 3000
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Development mode with auto-reload:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
taskdog-server --reload
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API Documentation
|
|
50
|
+
|
|
51
|
+
Once the server is running, visit:
|
|
52
|
+
|
|
53
|
+
- Interactive API docs: http://localhost:8000/docs
|
|
54
|
+
- Alternative docs: http://localhost:8000/redoc
|
|
55
|
+
- Health check: http://localhost:8000/health
|
|
56
|
+
|
|
57
|
+
For complete API reference, see [docs/API.md](../../docs/API.md).
|
|
58
|
+
|
|
59
|
+
## Authentication
|
|
60
|
+
|
|
61
|
+
Configure API key authentication in `~/.config/taskdog/server.toml`:
|
|
62
|
+
|
|
63
|
+
```toml
|
|
64
|
+
[auth]
|
|
65
|
+
enabled = true
|
|
66
|
+
|
|
67
|
+
[[auth.api_keys]]
|
|
68
|
+
name = "my-client"
|
|
69
|
+
key = "your-secret-key"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Clients authenticate via `X-Api-Key` header:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
curl -H "X-Api-Key: your-secret-key" http://localhost:8000/api/v1/tasks/
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
See [Authentication Documentation](../../docs/API.md#authentication) for details.
|
|
79
|
+
|
|
80
|
+
## WebSocket Real-time Updates
|
|
81
|
+
|
|
82
|
+
Connect to `/ws` for real-time task notifications:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
const ws = new WebSocket('ws://localhost:8000/ws?token=your-api-key');
|
|
86
|
+
|
|
87
|
+
ws.onmessage = (event) => {
|
|
88
|
+
const data = JSON.parse(event.data);
|
|
89
|
+
console.log('Event:', data.type); // task_created, task_updated, etc.
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Event types:**
|
|
94
|
+
|
|
95
|
+
- `task_created` - New task created
|
|
96
|
+
- `task_updated` - Task fields updated
|
|
97
|
+
- `task_deleted` - Task deleted
|
|
98
|
+
- `task_status_changed` - Task status changed
|
|
99
|
+
- `schedule_optimized` - Schedule optimization completed
|
|
100
|
+
|
|
101
|
+
**Note:** WebSocket uses an in-memory connection manager, so the server always runs as a single process.
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
Server configuration: `~/.config/taskdog/server.toml`
|
|
106
|
+
|
|
107
|
+
```toml
|
|
108
|
+
[auth]
|
|
109
|
+
enabled = true
|
|
110
|
+
|
|
111
|
+
[[auth.api_keys]]
|
|
112
|
+
name = "my-client"
|
|
113
|
+
key = "your-secret-key"
|
|
114
|
+
|
|
115
|
+
[audit]
|
|
116
|
+
enabled = false
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Core configuration: `~/.config/taskdog/core.toml`
|
|
120
|
+
|
|
121
|
+
```toml
|
|
122
|
+
[region]
|
|
123
|
+
country = "JP"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
See [Configuration Guide](../../docs/CONFIGURATION.md) for all options.
|
|
127
|
+
|
|
128
|
+
## Architecture
|
|
129
|
+
|
|
130
|
+
The server uses:
|
|
131
|
+
|
|
132
|
+
- **FastAPI**: Modern, fast web framework
|
|
133
|
+
- **Pydantic**: Data validation with type hints
|
|
134
|
+
- **uvicorn**: ASGI server
|
|
135
|
+
- **taskdog-core**: Core business logic and infrastructure
|
|
136
|
+
|
|
137
|
+
### API Routers
|
|
138
|
+
|
|
139
|
+
- `tasks.py` - Task CRUD operations
|
|
140
|
+
- `lifecycle.py` - Task status changes
|
|
141
|
+
- `relationships.py` - Dependencies and tags
|
|
142
|
+
- `analytics.py` - Statistics and reporting
|
|
143
|
+
- `notes.py` - Markdown notes
|
|
144
|
+
- `websocket.py` - Real-time updates
|
|
145
|
+
|
|
146
|
+
### Dependency Injection
|
|
147
|
+
|
|
148
|
+
Controllers are injected via FastAPI dependencies:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
CrudControllerDep = Annotated[TaskCrudController, Depends(get_crud_controller)]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Related Packages
|
|
155
|
+
|
|
156
|
+
- [taskdog-core](../taskdog-core/): Core business logic used by this package
|
|
157
|
+
- [taskdog-ui](../taskdog-ui/): CLI and TUI interfaces connecting to this server
|
|
158
|
+
- [taskdog-client](../taskdog-client/): HTTP client library for API access
|
|
159
|
+
- [taskdog-mcp](../taskdog-mcp/): MCP server for Claude Desktop integration
|
|
160
|
+
|
|
161
|
+
## Testing
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pytest tests/
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Deployment
|
|
168
|
+
|
|
169
|
+
### Systemd (Linux)
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
systemctl --user start taskdog-server
|
|
173
|
+
systemctl --user enable taskdog-server
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Docker
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
docker pull ghcr.io/kohei-wada/taskdog-server:main
|
|
180
|
+
docker run -d -p 8000:8000 -v taskdog-data:/data ghcr.io/kohei-wada/taskdog-server:main
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
See [contrib/README.md](../../contrib/README.md) for deployment details.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "taskdog-server"
|
|
3
|
+
version = "0.18.1"
|
|
4
|
+
description = "FastAPI server for Taskdog task management system"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Kohei Wada" }
|
|
9
|
+
]
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
keywords = ["task", "management", "api", "fastapi"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
dependencies = [
|
|
21
|
+
"taskdog-core==0.18.1",
|
|
22
|
+
"fastapi>=0.115.0",
|
|
23
|
+
"uvicorn[standard]>=0.32.0",
|
|
24
|
+
"pydantic>=2.10.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=7.0.0",
|
|
30
|
+
"pytest-cov>=4.0.0",
|
|
31
|
+
"pytest-asyncio>=1.0.0",
|
|
32
|
+
"httpx>=0.27.0", # For testing API endpoints
|
|
33
|
+
"mypy>=1.0.0",
|
|
34
|
+
"ruff>=0.7.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
taskdog-server = "taskdog_server.main:main"
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/Kohei-Wada/taskdog"
|
|
42
|
+
Repository = "https://github.com/Kohei-Wada/taskdog"
|
|
43
|
+
"Bug Tracker" = "https://github.com/Kohei-Wada/taskdog/issues"
|
|
44
|
+
|
|
45
|
+
[build-system]
|
|
46
|
+
requires = ["setuptools>=68.0.0", "wheel"]
|
|
47
|
+
build-backend = "setuptools.build_meta"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
packages = [
|
|
51
|
+
"taskdog_server",
|
|
52
|
+
"taskdog_server.api",
|
|
53
|
+
"taskdog_server.api.models",
|
|
54
|
+
"taskdog_server.api.routers",
|
|
55
|
+
"taskdog_server.config",
|
|
56
|
+
"taskdog_server.websocket",
|
|
57
|
+
"taskdog_server.infrastructure",
|
|
58
|
+
"taskdog_server.infrastructure.logging",
|
|
59
|
+
]
|
|
60
|
+
package-dir = { "" = "src" }
|
|
61
|
+
|
|
62
|
+
[tool.setuptools.package-data]
|
|
63
|
+
taskdog_server = ["py.typed"]
|
|
64
|
+
|
|
65
|
+
[tool.mypy]
|
|
66
|
+
python_version = "3.13"
|
|
67
|
+
strict = true
|
|
68
|
+
# Disable unused-ignore warnings (environment-dependent)
|
|
69
|
+
warn_unused_ignores = false
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
python_files = ["test_*.py"]
|
|
74
|
+
python_classes = ["Test*"]
|
|
75
|
+
python_functions = ["test_*"]
|
|
76
|
+
asyncio_mode = "auto"
|
|
77
|
+
filterwarnings = [
|
|
78
|
+
"ignore::ResourceWarning:holidays.*",
|
|
79
|
+
]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""FastAPI application factory and configuration."""
|
|
2
|
+
|
|
3
|
+
from collections.abc import AsyncIterator
|
|
4
|
+
from contextlib import asynccontextmanager
|
|
5
|
+
|
|
6
|
+
from fastapi import FastAPI
|
|
7
|
+
|
|
8
|
+
from taskdog_core.shared.config_manager import ConfigManager
|
|
9
|
+
from taskdog_server import __version__
|
|
10
|
+
from taskdog_server.api.dependencies import initialize_api_context
|
|
11
|
+
from taskdog_server.api.middleware import LoggingMiddleware
|
|
12
|
+
from taskdog_server.api.routers import (
|
|
13
|
+
analytics_router,
|
|
14
|
+
audit_router,
|
|
15
|
+
bulk_router,
|
|
16
|
+
lifecycle_router,
|
|
17
|
+
notes_router,
|
|
18
|
+
relationships_router,
|
|
19
|
+
tags_router,
|
|
20
|
+
tasks_router,
|
|
21
|
+
websocket_router,
|
|
22
|
+
)
|
|
23
|
+
from taskdog_server.config.server_config_manager import ServerConfigManager
|
|
24
|
+
from taskdog_server.infrastructure.logging.config import configure_logging
|
|
25
|
+
from taskdog_server.websocket.connection_manager import ConnectionManager
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def create_app() -> FastAPI:
|
|
29
|
+
"""Create and configure FastAPI application.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
FastAPI: Configured FastAPI application instance
|
|
33
|
+
"""
|
|
34
|
+
# Load configuration once for the entire app
|
|
35
|
+
config = ConfigManager.load()
|
|
36
|
+
server_config = ServerConfigManager.load()
|
|
37
|
+
|
|
38
|
+
@asynccontextmanager
|
|
39
|
+
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
|
40
|
+
"""FastAPI lifespan context manager.
|
|
41
|
+
|
|
42
|
+
Initializes logging, API context, and connection manager on startup.
|
|
43
|
+
Stores all state in app.state for proper scoping.
|
|
44
|
+
"""
|
|
45
|
+
# Startup: Configure logging first
|
|
46
|
+
configure_logging()
|
|
47
|
+
|
|
48
|
+
# Initialize API context and store in app.state
|
|
49
|
+
api_context = initialize_api_context(config)
|
|
50
|
+
app.state.api_context = api_context
|
|
51
|
+
|
|
52
|
+
# Store server config in app.state (for authentication)
|
|
53
|
+
app.state.server_config = server_config
|
|
54
|
+
|
|
55
|
+
# Initialize ConnectionManager in app.state (for WebSocket)
|
|
56
|
+
app.state.connection_manager = ConnectionManager()
|
|
57
|
+
|
|
58
|
+
yield
|
|
59
|
+
|
|
60
|
+
# Shutdown: Dispose shared database engine
|
|
61
|
+
api_context.close()
|
|
62
|
+
|
|
63
|
+
app = FastAPI(
|
|
64
|
+
title="Taskdog API",
|
|
65
|
+
description="Task management API with scheduling, dependencies, and analytics",
|
|
66
|
+
version=__version__,
|
|
67
|
+
lifespan=lifespan,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Add logging middleware (should be first to log all requests)
|
|
71
|
+
app.add_middleware(LoggingMiddleware)
|
|
72
|
+
|
|
73
|
+
# Register routers
|
|
74
|
+
app.include_router(bulk_router, prefix="/api/v1/tasks", tags=["bulk"])
|
|
75
|
+
app.include_router(tasks_router, prefix="/api/v1/tasks", tags=["tasks"])
|
|
76
|
+
app.include_router(lifecycle_router, prefix="/api/v1/tasks", tags=["lifecycle"])
|
|
77
|
+
app.include_router(
|
|
78
|
+
relationships_router, prefix="/api/v1/tasks", tags=["relationships"]
|
|
79
|
+
)
|
|
80
|
+
app.include_router(notes_router, prefix="/api/v1/tasks", tags=["notes"])
|
|
81
|
+
app.include_router(analytics_router, prefix="/api/v1", tags=["analytics"])
|
|
82
|
+
app.include_router(tags_router, prefix="/api/v1/tags", tags=["tags"])
|
|
83
|
+
app.include_router(audit_router, prefix="/api/v1/audit-logs", tags=["audit"])
|
|
84
|
+
app.include_router(websocket_router, tags=["websocket"])
|
|
85
|
+
|
|
86
|
+
@app.get("/")
|
|
87
|
+
async def root() -> dict[str, str]:
|
|
88
|
+
"""Root endpoint."""
|
|
89
|
+
return {"message": "Taskdog API", "version": __version__}
|
|
90
|
+
|
|
91
|
+
@app.get("/health")
|
|
92
|
+
async def health() -> dict[str, str]:
|
|
93
|
+
"""Health check endpoint."""
|
|
94
|
+
return {"status": "ok"}
|
|
95
|
+
|
|
96
|
+
return app
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
# Create app instance
|
|
100
|
+
app = create_app()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""API context for dependency injection."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
|
|
5
|
+
from sqlalchemy.engine import Engine
|
|
6
|
+
|
|
7
|
+
from taskdog_core.controllers.audit_log_controller import AuditLogController
|
|
8
|
+
from taskdog_core.controllers.bulk_task_controller import BulkTaskController
|
|
9
|
+
from taskdog_core.controllers.query_controller import QueryController
|
|
10
|
+
from taskdog_core.controllers.task_analytics_controller import TaskAnalyticsController
|
|
11
|
+
from taskdog_core.controllers.task_crud_controller import TaskCrudController
|
|
12
|
+
from taskdog_core.controllers.task_lifecycle_controller import TaskLifecycleController
|
|
13
|
+
from taskdog_core.controllers.task_relationship_controller import (
|
|
14
|
+
TaskRelationshipController,
|
|
15
|
+
)
|
|
16
|
+
from taskdog_core.domain.repositories.notes_repository import NotesRepository
|
|
17
|
+
from taskdog_core.domain.repositories.task_repository import TaskRepository
|
|
18
|
+
from taskdog_core.domain.services.holiday_checker import IHolidayChecker
|
|
19
|
+
from taskdog_core.domain.services.time_provider import ITimeProvider
|
|
20
|
+
from taskdog_core.shared.config_manager import Config
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class ApiContext:
|
|
25
|
+
"""Context object for API endpoints containing shared dependencies.
|
|
26
|
+
|
|
27
|
+
Attributes:
|
|
28
|
+
repository: Task repository for data access
|
|
29
|
+
config: Application configuration
|
|
30
|
+
notes_repository: Notes repository for notes file operations
|
|
31
|
+
query_controller: Controller for task read operations
|
|
32
|
+
lifecycle_controller: Controller for task lifecycle operations (start, complete, etc.)
|
|
33
|
+
relationship_controller: Controller for task relationships (dependencies, tags, hours)
|
|
34
|
+
analytics_controller: Controller for analytics operations (statistics, optimization)
|
|
35
|
+
crud_controller: Controller for CRUD operations (create, update, archive, etc.)
|
|
36
|
+
holiday_checker: Holiday checker for workday validation (optional)
|
|
37
|
+
time_provider: Time provider for current time (optional, defaults to SystemTimeProvider)
|
|
38
|
+
audit_log_controller: Controller for audit log operations
|
|
39
|
+
engine: Shared SQLAlchemy engine (owned by this context)
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
repository: TaskRepository
|
|
43
|
+
config: Config
|
|
44
|
+
notes_repository: NotesRepository
|
|
45
|
+
query_controller: QueryController
|
|
46
|
+
lifecycle_controller: TaskLifecycleController
|
|
47
|
+
relationship_controller: TaskRelationshipController
|
|
48
|
+
analytics_controller: TaskAnalyticsController
|
|
49
|
+
crud_controller: TaskCrudController
|
|
50
|
+
holiday_checker: IHolidayChecker | None
|
|
51
|
+
time_provider: ITimeProvider
|
|
52
|
+
audit_log_controller: AuditLogController
|
|
53
|
+
bulk_controller: BulkTaskController | None = None
|
|
54
|
+
engine: Engine | None = field(default=None, repr=False)
|
|
55
|
+
|
|
56
|
+
def close(self) -> None:
|
|
57
|
+
"""Dispose the shared engine to release database connections."""
|
|
58
|
+
if self.engine is not None:
|
|
59
|
+
self.engine.dispose()
|
|
60
|
+
self.engine = None
|