Automated Action 6da81ed97c Complete Todo application implementation
- Update database path configuration
- Add test script for API functionality
- Update README with testing instructions
- Add requests package to requirements

generated with BackendIM... (backend.im)
2025-05-13 06:19:17 +00:00

2.4 KiB

Todo Application

A simple Todo application built with FastAPI and SQLite.

Features

  • Create, read, update, and delete todo items
  • SQLite database with SQLAlchemy ORM
  • Database migrations with Alembic
  • Health check endpoint
  • OpenAPI documentation
  • Test script for API functionality

Project Structure

todoapplication/
├── alembic/                  # Database migrations
├── app/                      # Application code
│   ├── api/                  # API routes and endpoints
│   │   ├── crud/             # CRUD operations
│   │   ├── endpoints/        # API endpoint implementations
│   ├── core/                 # Core functionality
│   │   ├── config.py         # Application configuration
│   ├── db/                   # Database related code
│   │   ├── session.py        # Database session management
│   ├── models/               # SQLAlchemy models
│   │   ├── todo.py           # Todo model
│   ├── schemas/              # Pydantic schemas
│   │   ├── todo.py           # Todo schemas
├── storage/                  # Storage directory
│   ├── db/                   # Database files location
├── alembic.ini               # Alembic configuration
├── main.py                   # Application entry point
├── requirements.txt          # Python dependencies
├── test_api.py               # API testing script

API Endpoints

  • GET /api/v1/todos: Get all todos
  • POST /api/v1/todos: Create a new todo
  • GET /api/v1/todos/{todo_id}: Get a specific todo
  • PUT /api/v1/todos/{todo_id}: Update a specific todo
  • DELETE /api/v1/todos/{todo_id}: Delete a specific todo
  • GET /health: Health check endpoint
  • GET /docs: API documentation (Swagger UI)
  • GET /redoc: API documentation (ReDoc)

Getting Started

Prerequisites

  • Python 3.8+

Installation

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
uvicorn main:app --reload

The application will be available at http://localhost:8000.

Database Migrations

Run migrations:

alembic upgrade head

Create a new migration:

alembic revision -m "your migration message"

Testing

Run the API tests (make sure the server is running first):

python test_api.py

This will test all the CRUD operations for the Todo API.