Automated Action 28f6914da1 Build task manager API with FastAPI and SQLite
- Set up project structure with FastAPI
- Implement SQLAlchemy models for User and Task
- Create Alembic migrations
- Implement authentication with JWT
- Add CRUD operations for tasks
- Add task filtering and prioritization
- Configure health check endpoint
- Update README with project documentation
2025-06-17 08:37:23 +00:00

137 lines
3.0 KiB
Markdown

# Task Manager API
A RESTful API for managing tasks, built with FastAPI and SQLite.
## Features
- User registration and authentication with JWT tokens
- CRUD operations for tasks
- Task filtering by status
- Task prioritization
- Due dates and completion tracking
- Health check endpoint
- OpenAPI documentation
## Getting Started
### Prerequisites
- Python 3.8+
- pip (Python package manager)
### Installation
1. Clone this repository:
```bash
git clone <repository-url>
cd taskmanagerapi-oyn0px
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables (optional):
```bash
# For production, you should change these values
export SECRET_KEY="CHANGE_ME_IN_PRODUCTION"
export ACCESS_TOKEN_EXPIRE_MINUTES=10080 # 7 days
```
4. Apply database migrations:
```bash
alembic upgrade head
```
5. Start the server:
```bash
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```
The API will be available at http://localhost:8000
## API Documentation
Once the server is running, you can access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
## API Endpoints
### Authentication
- `POST /api/v1/auth/register` - Register a new user
- `POST /api/v1/auth/login` - Login and get access token
### Users
- `GET /api/v1/users/me` - Get current user information
- `PATCH /api/v1/users/me` - Update current user information
### Tasks
- `GET /api/v1/tasks` - List all tasks for the current user
- `POST /api/v1/tasks` - Create a new task
- `GET /api/v1/tasks/{task_id}` - Get a specific task
- `PATCH /api/v1/tasks/{task_id}` - Update a task
- `DELETE /api/v1/tasks/{task_id}` - Delete a task
### Health Check
- `GET /health` - Check API health status
## Task Model
Tasks have the following properties:
- `id`: Unique identifier (string)
- `title`: Task title (string, required)
- `description`: Task description (string, optional)
- `status`: Task status (enum: todo, in_progress, done)
- `priority`: Task priority (enum: low, medium, high)
- `due_date`: Due date for the task (datetime, optional)
- `completed_at`: When the task was completed (datetime, set automatically when status changes to "done")
- `created_at`: When the task was created (datetime, automatic)
- `updated_at`: When the task was last updated (datetime, automatic)
## Database
The API uses SQLite as the database. The database file is stored at `/app/storage/db/db.sqlite`.
## Development
### Running Tests
To run the tests (when implemented):
```bash
pytest
```
### Linting
To run linting:
```bash
ruff check .
```
To automatically fix linting issues:
```bash
ruff check --fix .
```
## Contributing
1. Fork the repository
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature/my-new-feature`
5. Submit a pull request
## License
This project is licensed under the MIT License - see the LICENSE file for details.