24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
"""Table operations_bancaires — suivi du compte bancaire."""
|
|
import uuid
|
|
from datetime import date, datetime, timezone
|
|
from sqlalchemy import String, Date, DateTime, Text, ForeignKey, Numeric, Enum as SAEnum
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from app.core.database import Base
|
|
|
|
|
|
class OperationBancaire(Base):
|
|
__tablename__ = "operations_bancaires"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
|
|
groupe_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("groupes.id"), nullable=False)
|
|
type: Mapped[str] = mapped_column(
|
|
SAEnum("depot", "retrait", "releve", name="type_operation_bancaire"),
|
|
nullable=False,
|
|
)
|
|
montant: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False)
|
|
date_operation: Mapped[date] = mapped_column(Date, nullable=False)
|
|
effectue_par: Mapped[uuid.UUID] = mapped_column(ForeignKey("membres.id"), nullable=False)
|
|
note: Mapped[str | None] = mapped_column(Text)
|
|
cree_le: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
|
)
|