
- Set up project structure with FastAPI - Create database models for notes - Implement Alembic migrations - Create API endpoints for note CRUD operations - Implement note export functionality (markdown, txt, pdf) - Add health endpoint - Set up linting with Ruff
36 lines
694 B
Python
36 lines
694 B
Python
from datetime import datetime
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class NoteBase(BaseModel):
|
|
title: str = Field(..., min_length=1, max_length=255)
|
|
content: str = Field(..., min_length=1)
|
|
|
|
|
|
class NoteCreate(NoteBase):
|
|
pass
|
|
|
|
|
|
class NoteUpdate(BaseModel):
|
|
title: Optional[str] = Field(None, min_length=1, max_length=255)
|
|
content: Optional[str] = Field(None, min_length=1)
|
|
|
|
|
|
class NoteInDB(NoteBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class Note(NoteInDB):
|
|
pass
|
|
|
|
|
|
class NoteExport(BaseModel):
|
|
format: Literal["markdown", "txt", "pdf"] = "markdown"
|