REST API for managing personal bookmarks (title, link, category). PostgreSQL database with async SQLAlchemy, containerized with Docker Compose. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
21 lines
680 B
Python
21 lines
680 B
Python
import uuid
|
|
|
|
from sqlalchemy import DateTime, String, func
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
pass
|
|
|
|
|
|
class Bookmark(Base):
|
|
__tablename__ = "bookmarks"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
|
|
)
|
|
title: Mapped[str] = mapped_column(String(500), nullable=False)
|
|
link: Mapped[str] = mapped_column(String(2000), nullable=False)
|
|
category: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
created_at = mapped_column(DateTime(timezone=True), server_default=func.now())
|