Automated Action 00174fd9dc Create REST API with FastAPI and SQLite
- Set up project structure with FastAPI
- Configure SQLite database with SQLAlchemy
- Set up Alembic for migrations
- Create Item model and schema
- Implement CRUD operations
- Add health endpoint

generated with BackendIM... (backend.im)
2025-05-13 21:57:29 +00:00

37 lines
693 B
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel
# Shared properties
class ItemBase(BaseModel):
title: str
description: Optional[str] = None
is_active: bool = True
# Properties to receive on item creation
class ItemCreate(ItemBase):
pass
# Properties to receive on item update
class ItemUpdate(ItemBase):
title: Optional[str] = None
is_active: Optional[bool] = None
# Properties shared by models stored in DB
class ItemInDBBase(ItemBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
# Properties to return to client
class Item(ItemInDBBase):
pass