Skip to content

Repository files navigation

🗂️ Task Management API

AI-400 Class 1 Project | FastAPI + SQLModel + pytest

A complete Task Management REST API built with FastAPI, SQLModel, and pytest — plus 5 reusable agent skills.


📦 Project Structure

task-api/
├── app/
│   ├── __init__.py
│   └── main.py              ← All API routes and database models
├── tests/
│   ├── __init__.py
│   └── test_tasks.py        ← All pytest tests
├── skills/
│   ├── fastapi-skill/       ← Technical Skill 1
│   │   └── SKILL.md
│   ├── pytest-skill/        ← Technical Skill 2
│   │   └── SKILL.md
│   └── sqlmodel-skill/      ← Technical Skill 3
│       └── SKILL.md
├── requirements.txt
└── README.md

📁 Daily workflow skills (assignment-writer, paper-summarizer, study-planner, email-composer, code-explainer) are in the companion student-skills/ repository.


🚀 Quick Start (Windows)

Step 1 — Install Python

Download Python 3.11+ from https://python.org ✅ Check "Add Python to PATH" during installation

Step 2 — Open Terminal

Press Windows + R → type cmd → press Enter

Step 3 — Install dependencies

pip install -r requirements.txt

Step 4 — Run the API

uvicorn app.main:app --reload

Step 5 — Open in browser

Go to: http://localhost:8000/docs

You'll see the interactive API documentation — you can test all endpoints there! ✅


🔌 API Endpoints

Method Route Description
GET / Welcome message
POST /tasks/ Create a new task
GET /tasks/ Get all tasks
GET /tasks/{id} Get one task by ID
PUT /tasks/{id} Update a task
DELETE /tasks/{id} Delete a task

🧪 Running Tests

pytest tests/ -v

Expected output:

PASSED tests/test_tasks.py::test_root
PASSED tests/test_tasks.py::test_create_task
PASSED tests/test_tasks.py::test_get_all_tasks
PASSED tests/test_tasks.py::test_get_single_task
PASSED tests/test_tasks.py::test_get_task_not_found
PASSED tests/test_tasks.py::test_update_task
PASSED tests/test_tasks.py::test_delete_task
PASSED tests/test_tasks.py::test_delete_task_not_found

8 passed ✅

🛠️ Skills Included

Technical Skills (3)

Skill Replaces Time Saved
fastapi-skill Hours reading FastAPI docs 3–5 hrs/project
pytest-skill Manual API testing + test setup 2–4 hrs/project
sqlmodel-skill Database design confusion 2–3 hrs/project

Daily Workflow Skills (2 — from student-skills repo)

Skill Replaces Time Saved
assignment-writer Writing CS assignments from scratch 3–4 hrs/assignment
code-explainer Googling confusing code line by line 1–2 hrs/session

🧰 Tech Stack

Technology Purpose
FastAPI Building the REST API
SQLModel Database models + SQLite storage
pytest Automated testing
uvicorn Running the API server

📋 Example Usage

Create a Task

curl -X POST "http://localhost:8000/tasks/" \
  -H "Content-Type: application/json" \
  -d '{"title": "Learn FastAPI", "description": "Build my first API", "completed": false}'

Get All Tasks

curl "http://localhost:8000/tasks/"

Mark Task as Complete

curl -X PUT "http://localhost:8000/tasks/1" \
  -H "Content-Type: application/json" \
  -d '{"title": "Learn FastAPI", "completed": true}'

Delete a Task

curl -X DELETE "http://localhost:8000/tasks/1"

Built for AI-400: Cloud-Native AI with Docker, Kubernetes & Dapr — Panaversity

About

Task Management API built with FastAPI, SQLModel, and pytest — AI-400 Class 1 Project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages