groupe-meditation/backend/app/models/reserve.py

19 lines
871 B
Python

"""Table reserves — montants mis de cote par le groupe."""
import uuid
from datetime import datetime, timezone
from sqlalchemy import Boolean, DateTime, ForeignKey, Numeric, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import Base
class Reserve(Base):
__tablename__ = "reserves"
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
groupe_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("groupes.id"), nullable=False)
nom: Mapped[str] = mapped_column(String(120), nullable=False)
montant: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False)
note: Mapped[str | None] = mapped_column(Text)
active: Mapped[bool] = mapped_column(Boolean, default=True)
cree_le: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))