
- Implemented full CRUD operations for tasks - Added SQLite database with SQLAlchemy ORM - Set up Alembic migrations for database schema - Created health check and base URL endpoints - Added CORS middleware for cross-origin requests - Included comprehensive API documentation - Updated README with complete project information
2.4 KiB
2.4 KiB
Task Management Tool
A FastAPI-based task management system that allows you to create, read, update, and delete tasks.
Features
- CRUD Operations: Create, read, update, and delete tasks
- Task Properties: Each task has a title, description, completion status, and priority level
- SQLite Database: Data persistence using SQLite with SQLAlchemy ORM
- API Documentation: Automatic API documentation with Swagger UI
- Health Check: Built-in health check endpoint
- CORS Support: Cross-origin resource sharing enabled
API Endpoints
Base Endpoints
GET /
- API information and linksGET /health
- Health check endpointGET /docs
- Swagger UI documentationGET /redoc
- ReDoc documentationGET /openapi.json
- OpenAPI specification
Task Endpoints
POST /tasks/
- Create a new taskGET /tasks/
- Get all tasks (with pagination)GET /tasks/{task_id}
- Get a specific task by IDPUT /tasks/{task_id}
- Update a specific taskDELETE /tasks/{task_id}
- Delete a specific task
Installation and Setup
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
uvicorn main:app --host 0.0.0.0 --port 8000
The application will be available at http://localhost:8000
Task Model
Each task has the following properties:
id
: Unique identifier (auto-generated)title
: Task title (required)description
: Task description (optional)completed
: Completion status (default: false)priority
: Priority level - "low", "medium", "high" (default: "medium")created_at
: Creation timestamp (auto-generated)updated_at
: Last update timestamp (auto-updated)
Environment Variables
No environment variables are required for basic operation. The application uses SQLite database stored at /app/storage/db/db.sqlite
.
Database
The application uses SQLite database with Alembic for migrations. The database will be automatically created when the application starts.
Development
- Database models are in
app/models/
- API routes are in
app/routers/
- Pydantic schemas are in
app/schemas/
- Database configuration is in
app/db/
Health Check
The /health
endpoint provides information about the application and database status:
- Returns service status
- Checks database connectivity
- Provides error information if issues are detected