Automated Action c0ee807199 Fix Base import in db/base.py for Alembic migrations
- Updated app/db/base.py to properly export Base class
- Fixed error when running Alembic migrations due to missing Base import
- Added proper imports for models
2025-05-24 22:47:10 +00:00
2025-05-24 22:35:42 +00:00

Todo API

A simple Todo application API built with FastAPI and SQLite.

Features

  • RESTful API using FastAPI
  • SQLite database with SQLAlchemy ORM
  • Database migrations using Alembic
  • CRUD operations for Todo items
  • Health check endpoint
  • OpenAPI documentation

Project Structure

/
├── app/
│   ├── api/
│   │   ├── v1/
│   │   │   ├── health.py
│   │   │   └── todos.py
│   │   ├── deps.py
│   │   └── routers.py
│   ├── core/
│   │   └── config.py
│   ├── crud/
│   │   ├── base.py
│   │   └── todo.py
│   ├── db/
│   │   ├── base.py
│   │   ├── base_class.py
│   │   └── session.py
│   ├── models/
│   │   └── todo.py
│   └── schemas/
│       └── todo.py
├── migrations/
│   ├── versions/
│   │   └── 01_initial_todo_table.py
│   ├── env.py
│   └── script.py.mako
├── alembic.ini
├── main.py
└── requirements.txt

Installation

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt

Database Setup

The application uses SQLite as its database. The database will be created at /app/storage/db/db.sqlite when the application starts.

To run the migrations:

alembic upgrade head

Running the Application

To run the application locally:

uvicorn main:app --reload

The API will be available at http://localhost:8000

API Documentation

API documentation is available at:

API Endpoints

Health Check

  • GET /api/v1/health - Check API health

Todo Endpoints

  • GET /api/v1/todos - List all todos
  • POST /api/v1/todos - Create a new todo
  • GET /api/v1/todos/{id} - Get a specific todo
  • PUT /api/v1/todos/{id} - Update a todo
  • DELETE /api/v1/todos/{id} - Delete a todo

Query Parameters

List todos

  • skip - Number of records to skip (default: 0)
  • limit - Maximum number of records to return (default: 100)
  • completed - Filter by completion status (optional, boolean)
Description
Project: Todo App Backend
Readme 41 KiB
Languages
Python 96.3%
Mako 3.7%