backend / app /model /base.py
praneethys's picture
transactions endpoints and pytests (#6)
81ec8d6 verified
raw
history blame
554 Bytes
from datetime import datetime, timezone
from sqlalchemy import DateTime
from sqlalchemy.orm import Mapped, mapped_column
from app.engine.postgresdb import Base
class BaseModel:
id: Mapped[int] = mapped_column(primary_key=True, index=True, autoincrement=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=datetime.now(timezone.utc))
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
default=datetime.now(timezone.utc),
onupdate=datetime.now(timezone.utc),
)