Initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
35
backend/models.py
Normal file
35
backend/models.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from datetime import date, datetime
|
||||
from sqlalchemy import Integer, Date, DateTime, Text, Numeric, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from database import Base
|
||||
|
||||
|
||||
class EggCollection(Base):
|
||||
__tablename__ = "egg_collections"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
date: Mapped[date] = mapped_column(Date, nullable=False, index=True)
|
||||
eggs: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
notes: Mapped[str] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class FlockHistory(Base):
|
||||
__tablename__ = "flock_history"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
date: Mapped[date] = mapped_column(Date, nullable=False, index=True)
|
||||
chicken_count: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
notes: Mapped[str] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class FeedPurchase(Base):
|
||||
__tablename__ = "feed_purchases"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
date: Mapped[date] = mapped_column(Date, nullable=False, index=True)
|
||||
bags: Mapped[float] = mapped_column(Numeric(5, 2), nullable=False)
|
||||
price_per_bag: Mapped[float] = mapped_column(Numeric(10, 2), nullable=False)
|
||||
notes: Mapped[str] = mapped_column(Text, nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
Reference in New Issue
Block a user