notesapi-q3b8fl/app/schemas/collection.py
Automated Action 741f301b11 Implement Notes API with FastAPI and SQLite
- Set up project structure with FastAPI
- Implement user authentication system with JWT tokens
- Create database models for users, notes, and collections
- Set up SQLAlchemy ORM and Alembic migrations
- Implement CRUD operations for notes and collections
- Add filtering and sorting capabilities for notes
- Implement health check endpoint
- Update project documentation
2025-05-31 14:54:14 +00:00

38 lines
623 B
Python

from datetime import datetime
from pydantic import BaseModel
from app.schemas.note import Note
class CollectionBase(BaseModel):
name: str
description: str | None = None
class CollectionCreate(CollectionBase):
pass
class CollectionUpdate(BaseModel):
name: str | None = None
description: str | None = None
class CollectionInDBBase(CollectionBase):
id: int
owner_id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True
class Collection(CollectionInDBBase):
pass
class CollectionWithNotes(Collection):
notes: list[Note] = []