CoolFace
Apppublic

DevMuhammadFasih/aidd-todo-api

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes
README.md106 linesDownload Raw Back to root
1---2title: AIDD Todo API3emoji: ✅4colorFrom: blue5colorTo: green6sdk: docker7app_port: 78608---9 10# AIDD Todo API11 12Python backend with dual interfaces:13- **Phase 1**: Console application with Rich UI14- **Phase 2**: FastAPI RESTful API with Swagger documentation15 16## Prerequisites17 18- Python 3.13+19- UV package manager20 21## Installation22 231. Navigate to the backend directory:24```bash25cd backend26```27 282. Install dependencies:29```bash30uv sync31```32 33## Running the Application34 35### Phase 1: Console Application36```bash37uv run python -m backend.main38```39 40### Phase 2: API Server41```bash42uv run uvicorn backend.api.main:app --reload --host 0.0.0.0 --port 800043```44 45**API Documentation**: http://localhost:8000/docs (Swagger UI)46 47## API Endpoints (Phase 2)48 49| Method | Endpoint | Description |50|--------|----------|-------------|51| `GET` | `/tasks` | List all tasks |52| `POST` | `/tasks` | Create a new task |53| `GET` | `/tasks/{id}` | Get task by ID |54| `PUT` | `/tasks/{id}` | Update task |55| `DELETE` | `/tasks/{id}` | Delete task |56 57### Example: Create a Task (cURL)58```bash59curl -X POST http://localhost:8000/tasks \60  -H "Content-Type: application/json" \61  -d '{"title": "Buy groceries", "description": "Milk, eggs, bread"}'62```63 64**Response**:65```json66{67  "id": 1,68  "title": "Buy groceries",69  "description": "Milk, eggs, bread",70  "status": "Pending"71}72```73 74## Console Usage Examples (Phase 1)75 76**See the console application menu for interactive task management with Rich UI.**77 78## Development79 80### Running Tests (Optional)81```bash82uv run pytest83```84 85### Type Checking86```bash87uv run mypy src88```89 90### Keyboard Shortcuts91- **Ctrl+C**: Exit application immediately92 93## Architecture94 95### Domain Layer (Phase 1)96- **models.py**: Task dataclass and TaskStatus enum97- **services.py**: TaskService (business logic)98- **ui.py**: ConsoleUI (Rich-based interface)99- **main.py**: Console application entry point100 101### API Layer (Phase 2)102- **api/main.py**: FastAPI app initialization with CORS103- **api/routes.py**: RESTful endpoints (GET, POST, PUT, DELETE)104- **api/schemas.py**: Pydantic v2 request/response models105 106**Storage**: In-memory (shared between console and API interfaces)